Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crosschain restaking w/o blueprints #49

Open
wants to merge 2 commits into
base: xc-restaking
Choose a base branch
from
Open
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
7 changes: 5 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ libs = ["lib"]
# optimizer = true (default)
optimizer_runs = 200
fs_permissions = [{ access = "read-write", path = "./" }]
solc = "0.8.20"
auto_detect_solc = true

remappings = [
"@openzeppelin/=node_modules/@openzeppelin/"
"@openzeppelin/=node_modules/@openzeppelin/",
"glacis-contracts/=lib/v1-core/contracts/",
"glacis-test/=lib/v1-core/test/",
"core/=src/assets/"
]


Expand Down
1 change: 1 addition & 0 deletions lib/v1-core
Submodule v1-core added at cb6a13
2 changes: 1 addition & 1 deletion src/BlueprintServiceManagerBase.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;
pragma solidity ^0.8.18;

import "./Permissions.sol";
import "./interfaces/IBlueprintServiceManager.sol";
Expand Down
4 changes: 2 additions & 2 deletions src/Permissions.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;
pragma solidity ^0.8.18;

contract Ownable {
address internal _owner;
Expand Down Expand Up @@ -55,7 +55,7 @@ contract RootChainEnabled {
}
}

contract RootChainEnabledOwnable is Ownable, RootChainEnabled {
abstract contract RootChainEnabledOwnable is Ownable, RootChainEnabled {
constructor() Ownable() RootChainEnabled() { }

modifier onlyOwnerOrRootChain() {
Expand Down
41 changes: 20 additions & 21 deletions src/assets/AssetDelegator.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;
pragma solidity ^0.8.18;

import { MultiAssetDelegation } from "../precompiles/MultiAssetDelegation.sol";

Expand Down Expand Up @@ -40,38 +40,37 @@ abstract contract AssetDelegator {
/// @param _asset The asset to operate on
/// @param _amount The amount to operate with
/// @param _operation The operation to perform
/// @return success Whether the operation was successful
function op(bytes32 _operator, address _asset, uint256 _amount, Operation _operation) public virtual returns (bool) {
uint8 result;
function op(
bytes32 _operator,
address _asset,
uint256 _amount,
uint8 _lockMultiplier,
uint64[] memory _blueprintSelection,
Operation _operation
)
public
virtual
{
uint256 assetId = uint256(uint160(_asset));

if (_operation == Operation.Deposit) {
result = DELEGATION.deposit(assetId, _amount);
if (result != 0) revert DelegationFailed();
DELEGATION.deposit(assetId, _asset, _amount, _lockMultiplier);
} else if (_operation == Operation.Delegate) {
result = DELEGATION.delegate(_operator, assetId, _amount);
if (result != 0) revert DelegationFailed();
DELEGATION.delegate(_operator, assetId, _asset, _amount, _blueprintSelection);
} else if (_operation == Operation.ScheduleUnstake) {
result = DELEGATION.scheduleDelegatorUnstake(_operator, assetId, _amount);
if (result != 0) revert UnstakeFailed();
DELEGATION.scheduleDelegatorUnstake(_operator, assetId, _asset, _amount);
} else if (_operation == Operation.CancelUnstake) {
result = DELEGATION.cancelDelegatorUnstake(_operator, assetId, _amount);
if (result != 0) revert UnstakeFailed();
DELEGATION.cancelDelegatorUnstake(_operator, assetId, _asset, _amount);
} else if (_operation == Operation.ExecuteUnstake) {
result = DELEGATION.executeDelegatorUnstake();
if (result != 0) revert UnstakeFailed();
DELEGATION.executeDelegatorUnstake();
} else if (_operation == Operation.ScheduleWithdraw) {
result = DELEGATION.scheduleWithdraw(assetId, _amount);
if (result != 0) revert WithdrawalFailed();
DELEGATION.scheduleWithdraw(assetId, _asset, _amount);
} else if (_operation == Operation.CancelWithdraw) {
result = DELEGATION.cancelWithdraw(assetId, _amount);
if (result != 0) revert WithdrawalFailed();
DELEGATION.cancelWithdraw(assetId, _asset, _amount);
} else if (_operation == Operation.ExecuteWithdraw) {
result = DELEGATION.executeWithdraw();
if (result != 0) revert WithdrawalFailed();
DELEGATION.executeWithdraw();
}

emit OperationExecuted(_asset, _operator, _operation, _amount);
return true;
}
}
143 changes: 0 additions & 143 deletions src/assets/AssetManager.sol

This file was deleted.

Loading