Skip to content

Commit

Permalink
chore(payments): rename payments escrow
Browse files Browse the repository at this point in the history
Signed-off-by: Tomás Migone <[email protected]>
  • Loading branch information
tmigone committed May 21, 2024
1 parent 896e3f5 commit 870d71e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
14 changes: 7 additions & 7 deletions packages/horizon/contracts/data-service/GraphDirectory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { IController } from "@graphprotocol/contracts/contracts/governance/ICont
import { IGraphToken } from "../interfaces/IGraphToken.sol";
import { IHorizonStaking } from "../interfaces/IHorizonStaking.sol";
import { IGraphPayments } from "../interfaces/IGraphPayments.sol";
import { IGraphEscrow } from "../interfaces/IGraphEscrow.sol";
import { IPaymentsEscrow } from "../interfaces/IPaymentsEscrow.sol";
import { IEpochManager } from "@graphprotocol/contracts/contracts/epochs/IEpochManager.sol";
import { IRewardsManager } from "@graphprotocol/contracts/contracts/rewards/IRewardsManager.sol";
import { ICuration } from "@graphprotocol/contracts/contracts/curation/ICuration.sol";
Expand All @@ -26,7 +26,7 @@ abstract contract GraphDirectory {
IGraphToken private immutable GRAPH_TOKEN;
IHorizonStaking private immutable GRAPH_STAKING;
IGraphPayments private immutable GRAPH_PAYMENTS;
IGraphEscrow private immutable GRAPH_ESCROW;
IPaymentsEscrow private immutable GRAPH_ESCROW;

// Legacy Graph contracts
// Required for StakingBackwardCompatibility
Expand All @@ -41,7 +41,7 @@ abstract contract GraphDirectory {
IGraphToken graphToken,
IHorizonStaking graphStaking,
IGraphPayments graphPayments,
IGraphEscrow graphEscrow,
IPaymentsEscrow graphEscrow,
IEpochManager graphEpochManager,
IRewardsManager graphRewardsManager,
ICuration graphCuration,
Expand All @@ -59,7 +59,7 @@ abstract contract GraphDirectory {
GRAPH_TOKEN = IGraphToken(_getContractFromController("GraphToken"));
GRAPH_STAKING = IHorizonStaking(_getContractFromController("Staking"));
GRAPH_PAYMENTS = IGraphPayments(_getContractFromController("GraphPayments"));
GRAPH_ESCROW = IGraphEscrow(_getContractFromController("GraphEscrow"));
GRAPH_ESCROW = IPaymentsEscrow(_getContractFromController("PaymentsEscrow"));
GRAPH_EPOCH_MANAGER = IEpochManager(_getContractFromController("EpochManager"));
GRAPH_REWARDS_MANAGER = IRewardsManager(_getContractFromController("RewardsManager"));
GRAPH_CURATION = ICuration(_getContractFromController("Curation"));
Expand Down Expand Up @@ -94,7 +94,7 @@ abstract contract GraphDirectory {
return GRAPH_PAYMENTS;
}

function _graphEscrow() internal view returns (IGraphEscrow) {
function _graphEscrow() internal view returns (IPaymentsEscrow) {
return GRAPH_ESCROW;
}

Expand All @@ -114,8 +114,8 @@ abstract contract GraphDirectory {
return GRAPH_TOKEN_GATEWAY;
}

function _getContractFromController(bytes memory __contractName) private view returns (address) {
address contractAddress = GRAPH_CONTROLLER.getContractProxy(keccak256(contractName));
function _getContractFromController(bytes memory _contractName) private view returns (address) {
address contractAddress = GRAPH_CONTROLLER.getContractProxy(keccak256(_contractName));
if (contractAddress == address(0)) {
revert GraphDirectoryInvalidZeroAddress();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.24;

import { IGraphPayments } from "./IGraphPayments.sol";

interface IGraphEscrow {
interface IPaymentsEscrow {
struct EscrowAccount {
uint256 balance; // Total escrow balance for a sender-receiver pair
uint256 amountThawing; // Amount of escrow currently being thawed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
pragma solidity ^0.8.24;

import { IGraphToken } from "../interfaces/IGraphToken.sol";
import { IGraphEscrow } from "../interfaces/IGraphEscrow.sol";
import { IGraphPayments } from "../interfaces/IGraphPayments.sol";
import { IPaymentsEscrow } from "../interfaces/IPaymentsEscrow.sol";

import { TokenUtils } from "../libraries/TokenUtils.sol";

import { GraphDirectory } from "../data-service/GraphDirectory.sol";
import { GraphEscrowStorageV1Storage } from "./GraphEscrowStorage.sol";
import { PaymentsEscrowV1Storage } from "./PaymentsEscrowStorage.sol";

contract GraphEscrow is IGraphEscrow, GraphEscrowStorageV1Storage, GraphDirectory {
contract PaymentsEscrow is IPaymentsEscrow, PaymentsEscrowV1Storage, GraphDirectory {
using TokenUtils for IGraphToken;

// -- Events --
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.24;

import { IGraphEscrow } from "../interfaces/IGraphEscrow.sol";
import { IPaymentsEscrow } from "../interfaces/IPaymentsEscrow.sol";

contract GraphEscrowStorageV1Storage {
contract PaymentsEscrowV1Storage {
// Authorized collectors
mapping(address sender => mapping(address dataService => IGraphEscrow.Collector collector))
mapping(address sender => mapping(address dataService => IPaymentsEscrow.Collector collector))
public authorizedCollectors;

// Stores how much escrow each sender has deposited for each receiver, as well as thawing information
mapping(address sender => mapping(address receiver => IGraphEscrow.EscrowAccount escrowAccount))
mapping(address sender => mapping(address receiver => IPaymentsEscrow.EscrowAccount escrowAccount))
public escrowAccounts;

// The maximum thawing period (in seconds) for both escrow withdrawal and signer revocation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ abstract contract StakingBackwardsCompatibility is Managed, HorizonStakingV1Stor

{
// -- Pull tokens from the sender --
IGraphToken graphToken = _graphToken();
_graphToken().pullTokens(msg.sender, queryFees);

// -- Collect protocol tax --
Expand Down
6 changes: 3 additions & 3 deletions packages/horizon/test/GraphBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "forge-std/Test.sol";

import { Controller } from "@graphprotocol/contracts/contracts/governance/Controller.sol";

import { GraphEscrow } from "contracts/escrow/GraphEscrow.sol";
import { PaymentsEscrow } from "contracts/payments/PaymentsEscrow.sol";
import { GraphPayments } from "contracts/payments/GraphPayments.sol";
import { IHorizonStaking } from "contracts/interfaces/IHorizonStaking.sol";
import { HorizonStaking } from "contracts/staking/HorizonStaking.sol";
Expand All @@ -21,7 +21,7 @@ abstract contract GraphBaseTest is Test, Constants {
Controller public controller;
MockGRTToken public token;
GraphPayments public payments;
GraphEscrow public escrow;
PaymentsEscrow public escrow;
IHorizonStaking public staking;

HorizonStaking private stakingBase;
Expand Down Expand Up @@ -139,7 +139,7 @@ abstract contract GraphBaseTest is Test, Constants {
address(controller),
protocolPaymentCut
);
escrow = new GraphEscrow{salt: saltEscrow}(
escrow = new PaymentsEscrow{salt: saltEscrow}(
address(controller),
revokeCollectorThawingPeriod,
withdrawEscrowThawingPeriod
Expand Down

0 comments on commit 870d71e

Please sign in to comment.