Skip to content
Closed
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
20 changes: 12 additions & 8 deletions docs/architecture/core/messaging.puml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,27 @@ skinparam linetype ortho
package messaging {
interface IMessageDispatcher
interface IMessageProcessor
class Gateway
class MultiAdapter
interface IAdapter
}

class Gateway
class MultiAdapter
class Spoke
class SpokeHandler
class Hub
class HubHandler

interface IAdapter

Spoke <-> IMessageDispatcher
HubHandler <-> IMessageDispatcher
IMessageProcessor --> HubHandler
IMessageProcessor --> Spoke
Spoke --> IMessageDispatcher
Hub --> IMessageDispatcher
IMessageDispatcher -up-> SpokeHandler
IMessageDispatcher -up-> HubHandler
IMessageProcessor -up-> HubHandler
IMessageProcessor -up-> SpokeHandler

IMessageDispatcher --> Gateway

Gateway --> IMessageProcessor
Gateway -up-> IMessageProcessor
Gateway <-down-> MultiAdapter
MultiAdapter <-down-> "n" IAdapter

Expand Down
61 changes: 27 additions & 34 deletions docs/architecture/core/spoke.puml
Original file line number Diff line number Diff line change
@@ -1,52 +1,45 @@
@startuml spoke
title Spoke
title Spoke Architecture
hide empty members

skinparam linetype ortho

package core {
interface IGateway
interface IRequestManager
package "Messaging" <<cloud>> {
circle " " as messaging
}

package messaging {
interface ISpokeMessageSender
interface IMessageProcessor
package factories {
class TokenFactory
class PoolEscrowFactory
class PoolEscrow
}

class Spoke
class ShareToken
class SpokeHandler
class SpokeRegistry

class BalanceSheet
class TokenFactory
class VaultRegistry
class PoolEscrowFactory
class PoolEscrow

interface IVaultFactory
interface IVault
class ShareToken
interface ITransferHook
interface IRequestManager

Spoke --> TokenFactory
Spoke --> PoolEscrowFactory
Spoke o-- "n" ShareToken
Spoke --> IGateway
Spoke --> ISpokeMessageSender
Spoke --> VaultRegistry
Spoke <-> IRequestManager
Spoke <-- IMessageProcessor

VaultRegistry --> IVaultFactory
VaultRegistry o-[norank]- "n" IVault
Spoke -down-> SpokeRegistry
Spoke -up-> messaging

BalanceSheet --> Spoke
BalanceSheet --> ISpokeMessageSender
messaging --> SpokeHandler
messaging --> VaultRegistry
SpokeHandler --> SpokeRegistry
SpokeHandler --> TokenFactory
SpokeHandler --> PoolEscrowFactory

PoolEscrowFactory o-- "n" PoolEscrow
PoolEscrowFactory ..> PoolEscrow
BalanceSheet --> SpokeRegistry
VaultRegistry --> SpokeRegistry

ShareToken .[dotted].> ITransferHook
SpokeRegistry o-- "n" IRequestManager
SpokeRegistry o-- "n" ShareToken

TokenFactory ..> ShareToken
IVaultFactory ..> IVault
' Factories
TokenFactory ..> "n" ShareToken
PoolEscrowFactory ..> "n" PoolEscrow
ShareToken o--> ITransferHook

@enduml
3 changes: 3 additions & 0 deletions foundry.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
"name": "v0.0.17",
"rev": "c057d167139dc4878f10ab7133a8c069fa6b1601"
}
},
"lib/setup-helpers": {
"rev": "0b6c2c1a478a34a8f284ebabd57b951085952cdf"
}
}
59 changes: 45 additions & 14 deletions script/FullDeployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import {HubHandler} from "../src/core/hub/HubHandler.sol";
import {HubRegistry} from "../src/core/hub/HubRegistry.sol";
import {BalanceSheet} from "../src/core/spoke/BalanceSheet.sol";
import {GasService} from "../src/core/messaging/GasService.sol";
import {SpokeHandler} from "../src/core/spoke/SpokeHandler.sol";
import {SpokeRegistry} from "../src/core/spoke/SpokeRegistry.sol";
import {SpokeV3_1_0} from "../src/core/spoke/legacy/SpokeV3_1_0.sol";
import {VaultRegistry} from "../src/core/spoke/VaultRegistry.sol";
import {MultiAdapter} from "../src/core/messaging/MultiAdapter.sol";
import {ContractUpdater} from "../src/core/utils/ContractUpdater.sol";
Expand Down Expand Up @@ -135,6 +138,9 @@ contract FullDeployer is BaseDeployer, Constants {
TokenFactory public tokenFactory;
ContractUpdater public contractUpdater;
VaultRegistry public vaultRegistry;
SpokeRegistry public spokeRegistry;
SpokeHandler public spokeHandler;
SpokeV3_1_0 public spokeV3_1_0;
PoolEscrowFactory public poolEscrowFactory;

HubRegistry public hubRegistry;
Expand Down Expand Up @@ -297,11 +303,8 @@ contract FullDeployer is BaseDeployer, Constants {
)
);

spoke = Spoke(
create3(
createSalt("spoke", V3_1), abi.encodePacked(type(Spoke).creationCode, abi.encode(tokenFactory, batcher))
)
);
spoke =
Spoke(create3(createSalt("spoke", V3_1), abi.encodePacked(type(Spoke).creationCode, abi.encode(batcher))));

balanceSheet = BalanceSheet(
create3(
Expand All @@ -324,6 +327,29 @@ contract FullDeployer is BaseDeployer, Constants {
)
);

spokeRegistry = SpokeRegistry(
create3(
createSalt("spokeRegistry", V3_1),
abi.encodePacked(type(SpokeRegistry).creationCode, abi.encode(batcher))
)
);

spokeHandler = SpokeHandler(
create3(
createSalt("spokeHandler", V3_1),
abi.encodePacked(
type(SpokeHandler).creationCode, abi.encode(spokeRegistry, tokenFactory, poolEscrowFactory, batcher)
)
)
);

spokeV3_1_0 = SpokeV3_1_0(
create3(
createSalt("spokeV3_1_0", V3_1),
abi.encodePacked(type(SpokeV3_1_0).creationCode, abi.encode(batcher))
)
);

// Hub
hubRegistry = HubRegistry(
create3(
Expand Down Expand Up @@ -427,7 +453,9 @@ contract FullDeployer is BaseDeployer, Constants {
vaultRouter = VaultRouter(
create3(
createSalt("vaultRouter", V3_1),
abi.encodePacked(type(VaultRouter).creationCode, abi.encode(gateway, spoke, vaultRegistry, batcher))
abi.encodePacked(
type(VaultRouter).creationCode, abi.encode(gateway, spoke, spokeRegistry, vaultRegistry, batcher)
)
)
);

Expand Down Expand Up @@ -457,9 +485,9 @@ contract FullDeployer is BaseDeployer, Constants {
type(FreezeOnly).creationCode,
abi.encode(
address(root),
address(spoke),
address(spokeRegistry),
address(balanceSheet),
address(spoke),
address(spokeHandler),
batcher,
address(poolEscrowFactory),
address(0)
Expand All @@ -475,9 +503,9 @@ contract FullDeployer is BaseDeployer, Constants {
type(FullRestrictions).creationCode,
abi.encode(
address(root),
address(spoke),
address(spokeRegistry),
address(balanceSheet),
address(spoke),
address(spokeHandler),
batcher,
address(poolEscrowFactory),
address(0)
Expand All @@ -493,9 +521,9 @@ contract FullDeployer is BaseDeployer, Constants {
type(FreelyTransferable).creationCode,
abi.encode(
address(root),
address(spoke),
address(spokeRegistry),
address(balanceSheet),
address(spoke),
address(spokeHandler),
batcher,
address(poolEscrowFactory),
address(0)
Expand All @@ -511,9 +539,9 @@ contract FullDeployer is BaseDeployer, Constants {
type(RedemptionRestrictions).creationCode,
abi.encode(
address(root),
address(spoke),
address(spokeRegistry),
address(balanceSheet),
address(spoke),
address(spokeHandler),
batcher,
address(poolEscrowFactory),
address(0)
Expand Down Expand Up @@ -670,6 +698,9 @@ contract FullDeployer is BaseDeployer, Constants {
tokenFactory,
contractUpdater,
vaultRegistry,
spokeHandler,
spokeRegistry,
spokeV3_1_0,
hubRegistry,
accounting,
holdings,
Expand Down
6 changes: 3 additions & 3 deletions script/testnet/BaseTestData.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ abstract contract BaseTestData is LaunchDeployer {
);

// Test async redemption path for sync vaults
IShareToken shareToken = IShareToken(spoke.shareToken(poolId, scId));
IShareToken shareToken = IShareToken(spokeRegistry.shareToken(poolId, scId));
SyncDepositVault vault = SyncDepositVault(shareToken.vault(address(params.token)));

uint128 testDepositAmount = 1_000e6;
Expand Down Expand Up @@ -351,7 +351,7 @@ abstract contract BaseTestData is LaunchDeployer {
uint16 targetCentrifugeId
) internal {
// Get vault
IShareToken shareToken = IShareToken(spoke.shareToken(poolId, scId));
IShareToken shareToken = IShareToken(spokeRegistry.shareToken(poolId, scId));
IAsyncVault vault = IAsyncVault(shareToken.vault(address(token)));

// Submit deposit request
Expand Down Expand Up @@ -425,7 +425,7 @@ abstract contract BaseTestData is LaunchDeployer {
* @dev This is the sync vault test flow from TestData.s.sol
*/
function testSyncVaultFlow(PoolId poolId, ShareClassId scId, ERC20 token, uint128 investAmount) internal {
IShareToken shareToken = IShareToken(spoke.shareToken(poolId, scId));
IShareToken shareToken = IShareToken(spokeRegistry.shareToken(poolId, scId));
SyncDepositVault vault = SyncDepositVault(shareToken.vault(address(token)));

token.approve(address(vault), investAmount);
Expand Down
6 changes: 6 additions & 0 deletions script/utils/EnvConfig.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ struct ContractsConfig {
address hub;
address tokenFactory;
address spoke;
address spokeHandler;
address spokeRegistry;
address spokeV3_1_0;
address balanceSheet;
address contractUpdater;
address vaultRegistry;
Expand Down Expand Up @@ -236,6 +239,9 @@ library Env {
config.hub = _parseContractAddress(json, "hub");
config.tokenFactory = _parseContractAddress(json, "tokenFactory");
config.spoke = _parseContractAddress(json, "spoke");
config.spokeHandler = _tryParseContractAddress(json, "spokeHandler");
config.spokeRegistry = _tryParseContractAddress(json, "spokeRegistry");
config.spokeV3_1_0 = _tryParseContractAddress(json, "spokeV3_1_0");
config.balanceSheet = _parseContractAddress(json, "balanceSheet");
config.contractUpdater = _parseContractAddress(json, "contractUpdater");
config.vaultRegistry = _parseContractAddress(json, "vaultRegistry");
Expand Down
4 changes: 2 additions & 2 deletions snapshots/AsyncVault.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"fulfillDepositRequest": "939125",
"requestDeposit": "879641"
"fulfillDepositRequest": "952247",
"requestDeposit": "892015"
}
56 changes: 28 additions & 28 deletions snapshots/MessageGasLimits.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
{
"BENCHMARKING_RUN_ID": 1768323786,
"scheduleUpgrade": 93954,
"cancelUpgrade": 74410,
"recoverTokens": 150073,
"registerAsset": 104155,
"setPoolAdapters": 484965,
"request": 219858,
"notifyPool": 1280733,
"notifyShareClass": 1858390,
"notifyPricePoolPerShare": 102234,
"notifyPricePoolPerAsset": 106047,
"notifyShareMetadata": 115797,
"updateShareHook": 91761,
"initiateTransferShares": 282060,
"executeTransferShares": 172870,
"updateRestriction": 112670,
"BENCHMARKING_RUN_ID": 1771241961,
"scheduleUpgrade": 93932,
"cancelUpgrade": 74388,
"recoverTokens": 150051,
"registerAsset": 104133,
"setPoolAdapters": 484943,
"request": 219814,
"notifyPool": 1288230,
"notifyShareClass": 1919267,
"notifyPricePoolPerShare": 110198,
"notifyPricePoolPerAsset": 114033,
"notifyShareMetadata": 121449,
"updateShareHook": 97215,
"initiateTransferShares": 287671,
"executeTransferShares": 178481,
"updateRestriction": 118564,
"trustedContractUpdate": 143921,
"requestCallback": 330279,
"updateVaultDeployAndLink": 2841252,
"updateVaultLink": 182895,
"updateVaultUnlink": 131662,
"setRequestManager": 101098,
"updateBalanceSheetManager": 99987,
"updateHoldingAmount": 300854,
"updateShares": 198271,
"maxAssetPriceAge": 106132,
"maxSharePriceAge": 103066,
"updateGatewayManager": 97645,
"untrustedContractUpdate": 85086
"requestCallback": 333924,
"updateVaultDeployAndLink": 2840082,
"updateVaultLink": 182359,
"updateVaultUnlink": 131126,
"setRequestManager": 108704,
"updateBalanceSheetManager": 99965,
"updateHoldingAmount": 300832,
"updateShares": 198249,
"maxAssetPriceAge": 114074,
"maxSharePriceAge": 110811,
"updateGatewayManager": 97623,
"untrustedContractUpdate": 85064
}
2 changes: 1 addition & 1 deletion snapshots/ShareToken.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"transferFrom": "80973"
"transferFrom": "80995"
}
2 changes: 1 addition & 1 deletion snapshots/SyncDepositVault.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"deposit": "359441"
"deposit": "372185"
}
8 changes: 4 additions & 4 deletions snapshots/VaultRouter.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"claimDeposit": "1179164",
"enable": "61122",
"requestDeposit": "889214",
"requestRedeem": "2573781"
"claimDeposit": "1192352",
"enable": "61144",
"requestDeposit": "901632",
"requestRedeem": "2610075"
}
Loading
Loading