Skip to content

Commit

Permalink
create staking orchestrator contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick95550 committed Jun 26, 2024
1 parent 26ae79e commit a43e8c9
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
9 changes: 9 additions & 0 deletions common/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const DeployedContractNames = {
authorizedAccounts: 'AuthorizedAccounts',
rewardsManager: 'RewardsManager',
ticketing: 'Ticketing',
StakingOrchestrator: 'StakingOrchestrator',
};

export const ContractNames = {
Expand All @@ -32,6 +33,7 @@ export type SyloContracts = {
authorizedAccounts: factories.contracts.AuthorizedAccounts;
rewardsManager: factories.contracts.RewardsManager;
ticketing: factories.contracts.Ticketing;
stakingOrchestrator: factories.contracts.staking.StakingOrchestrator;
};

export type ContractAddresses = {
Expand All @@ -45,6 +47,7 @@ export type ContractAddresses = {
authorizedAccounts: string;
rewardsManager: string;
ticketing: string;
stakingOrchestator: string;
};

export function connectContracts(
Expand Down Expand Up @@ -101,6 +104,11 @@ export function connectContracts(
provider,
);

const stakingOrchestrator = factories.StakingOrchestrator__factory.connect(
contracts.stakingOrchestator,
provider,
);

return {
syloToken,
syloStakingManager,
Expand All @@ -112,5 +120,6 @@ export function connectContracts(
authorizedAccounts,
rewardsManager,
ticketing,
stakingOrchestrator,
};
}
22 changes: 22 additions & 0 deletions contracts/staking/IStakingOrchestrator.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.18;

interface IStakingOrchestrator {
function getNodeCurrentStake(address node) external returns (uint256);

function getUserCurrentStake(address node, address user) external returns (uint256);

function getUserPeriodStake(
address node,
address user,
uint256 cycle
) external returns (uint256);

function syloStakeAdded(address node, address user, uint256 newAmount) external;

function syloStakeRemoved(address node, address user, uint256 newAmount) external;

function seekerStakeAdded(address node, address user, uint256 seekerId) external;

function seekerStakeRemoved(address node, address user, uint256 seekerId) external;
}
40 changes: 40 additions & 0 deletions contracts/staking/StakingOrchestrator.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.18;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol";

import "./IStakingOrchestrator.sol";

contract StakingOrchestrator is
IStakingOrchestrator,
Initializable,
Ownable2StepUpgradeable,
ERC165
{
function getNodeCurrentStake(address node) external returns (uint256) {
return 0;
}

function getUserCurrentStake(address node, address user) external returns (uint256) {
return 0;
}

function getUserPeriodStake(
address node,
address user,
uint256 cycle
) external returns (uint256) {
return 0;
}

function syloStakeAdded(address node, address user, uint256 newAmount) external {}

function syloStakeRemoved(address node, address user, uint256 newAmount) external {}

function seekerStakeAdded(address node, address user, uint256 seekerId) external {}

function seekerStakeRemoved(address node, address user, uint256 seekerId) external {}
}

0 comments on commit a43e8c9

Please sign in to comment.