Skip to content
Merged
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
13 changes: 0 additions & 13 deletions service_contracts/abi/ServiceProviderRegistry.abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,6 @@
"inputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "BURN_ACTOR",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "MAX_CAPABILITIES",
Expand Down
1 change: 1 addition & 0 deletions service_contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ remappings = [
'@fws-payments/=lib/fws-payments/src/',
'@pdp/=lib/pdp/src/',
'@session-key-registry/=lib/session-key-registry/src/',
'@fvm-solidity/=lib/pdp/lib/fvm-solidity/src/',
'@pythnetwork/pyth-sdk-solidity/=lib/pdp/lib/pyth-sdk-solidity/',
]

Expand Down
7 changes: 2 additions & 5 deletions service_contracts/src/ServiceProviderRegistry.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
pragma solidity ^0.8.20;

import {FVMPay} from "@fvm-solidity/FVMPay.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
Expand Down Expand Up @@ -47,9 +48,6 @@ contract ServiceProviderRegistry is
/// @notice Maximum length for location field
uint256 private constant MAX_LOCATION_LENGTH = 128;

/// @notice Burn actor address for burning FIL
address public constant BURN_ACTOR = 0xff00000000000000000000000000000000000063;

/// @notice Registration fee in attoFIL (5 FIL = 5 * 10^18 attoFIL)
uint256 public constant REGISTRATION_FEE = 5e18;

Expand Down Expand Up @@ -185,8 +183,7 @@ contract ServiceProviderRegistry is
emit ProductAdded(providerId, productType, msg.sender, productData, capabilityKeys, capabilityValues);

// Burn the registration fee
(bool burnSuccess,) = BURN_ACTOR.call{value: REGISTRATION_FEE}("");
require(burnSuccess, "Burn failed");
require(FVMPay.burn(REGISTRATION_FEE), "Burn failed");
}

/// @notice Add a new product to an existing provider
Expand Down
8 changes: 5 additions & 3 deletions service_contracts/test/FilecoinWarmStorageService.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {Test, console, Vm} from "forge-std/Test.sol";
import {MockFVMTest} from "@fvm-solidity/mocks/MockFVMTest.sol";
import {console, Test, Vm} from "forge-std/Test.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
Expand All @@ -21,7 +22,7 @@ import {Errors} from "../src/Errors.sol";
import {ServiceProviderRegistryStorage} from "../src/ServiceProviderRegistryStorage.sol";
import {ServiceProviderRegistry} from "../src/ServiceProviderRegistry.sol";

contract FilecoinWarmStorageServiceTest is Test {
contract FilecoinWarmStorageServiceTest is MockFVMTest {
using SafeERC20 for MockERC20;
using FilecoinWarmStorageServiceStateLibrary for FilecoinWarmStorageService;
// Testing Constants
Expand Down Expand Up @@ -92,7 +93,8 @@ contract FilecoinWarmStorageServiceTest is Test {
bytes extraData;
}

function setUp() public {
function setUp() public override {
super.setUp();
// Setup test accounts
deployer = address(this);
client = address(0xf1);
Expand Down
8 changes: 5 additions & 3 deletions service_contracts/test/FilecoinWarmStorageServiceOwner.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {Test, console} from "forge-std/Test.sol";
import {MockFVMTest} from "@fvm-solidity/mocks/MockFVMTest.sol";
import {console} from "forge-std/Test.sol";
import {FilecoinWarmStorageService} from "../src/FilecoinWarmStorageService.sol";
import {FilecoinWarmStorageServiceStateView} from "../src/FilecoinWarmStorageServiceStateView.sol";
import {ServiceProviderRegistry} from "../src/ServiceProviderRegistry.sol";
Expand All @@ -15,7 +16,7 @@ import {Errors} from "../src/Errors.sol";
import {MockERC20, MockPDPVerifier} from "./mocks/SharedMocks.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract FilecoinWarmStorageServiceOwnerTest is Test {
contract FilecoinWarmStorageServiceOwnerTest is MockFVMTest {
using SafeERC20 for MockERC20;

// Constants
Expand Down Expand Up @@ -49,7 +50,8 @@ contract FilecoinWarmStorageServiceOwnerTest is Test {
uint256 indexed dataSetId, address indexed oldServiceProvider, address indexed newServiceProvider
);

function setUp() public {
function setUp() public override {
super.setUp();
// Setup accounts
owner = address(this);
client = address(0x1);
Expand Down
7 changes: 4 additions & 3 deletions service_contracts/test/ProviderValidation.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {Test} from "forge-std/Test.sol";
import {MockFVMTest} from "@fvm-solidity/mocks/MockFVMTest.sol";
import {FilecoinPayV1} from "@fws-payments/FilecoinPayV1.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
Expand All @@ -16,7 +16,7 @@ import {ServiceProviderRegistryStorage} from "../src/ServiceProviderRegistryStor
import {MockERC20, MockPDPVerifier} from "./mocks/SharedMocks.sol";
import {Errors} from "../src/Errors.sol";

contract ProviderValidationTest is Test {
contract ProviderValidationTest is MockFVMTest {
using SafeERC20 for MockERC20;

FilecoinWarmStorageService public warmStorage;
Expand All @@ -40,7 +40,8 @@ contract ProviderValidationTest is Test {
uint8(27)
);

function setUp() public {
function setUp() public override {
super.setUp();
owner = address(this);
provider1 = address(0x1);
provider2 = address(0x2);
Expand Down
7 changes: 4 additions & 3 deletions service_contracts/test/ServiceProviderRegistry.t.sol
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

import {Test} from "forge-std/Test.sol";
import {MockFVMTest} from "@fvm-solidity/mocks/MockFVMTest.sol";
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import {ServiceProviderRegistry} from "../src/ServiceProviderRegistry.sol";
import {ServiceProviderRegistryStorage} from "../src/ServiceProviderRegistryStorage.sol";

contract ServiceProviderRegistryTest is Test {
contract ServiceProviderRegistryTest is MockFVMTest {
ServiceProviderRegistry public implementation;
ServiceProviderRegistry public registry;
address public owner;
address public user1;
address public user2;

function setUp() public {
function setUp() public override {
super.setUp();
owner = address(this);
user1 = address(0x1);
user2 = address(0x2);
Expand Down
12 changes: 7 additions & 5 deletions service_contracts/test/ServiceProviderRegistryFull.t.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

import {Test} from "forge-std/Test.sol";
import {BURN_ADDRESS} from "@fvm-solidity/FVMActors.sol";
import {MockFVMTest} from "@fvm-solidity/mocks/MockFVMTest.sol";
import {ServiceProviderRegistry} from "../src/ServiceProviderRegistry.sol";
import {ServiceProviderRegistryStorage} from "../src/ServiceProviderRegistryStorage.sol";
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract ServiceProviderRegistryFullTest is Test {
contract ServiceProviderRegistryFullTest is MockFVMTest {
ServiceProviderRegistry public implementation;
ServiceProviderRegistry public registry;

Expand All @@ -28,7 +29,8 @@ contract ServiceProviderRegistryFullTest is Test {
bytes public encodedDefaultPDPData;
bytes public encodedUpdatedPDPData;

function setUp() public {
function setUp() public override {
super.setUp();
owner = address(this);
provider1 = address(0x1);
provider2 = address(0x2);
Expand Down Expand Up @@ -102,7 +104,7 @@ contract ServiceProviderRegistryFullTest is Test {

function testRegisterProvider() public {
// Check burn actor balance before
uint256 burnActorBalanceBefore = registry.BURN_ACTOR().balance;
uint256 burnActorBalanceBefore = BURN_ADDRESS.balance;

vm.startPrank(provider1);

Expand Down Expand Up @@ -214,7 +216,7 @@ contract ServiceProviderRegistryFullTest is Test {
assertEq(datacenterValue, "EU-WEST", "Product first value should be EU-WEST");

// Verify fee was burned
uint256 burnActorBalanceAfter = registry.BURN_ACTOR().balance;
uint256 burnActorBalanceAfter = BURN_ADDRESS.balance;
assertEq(burnActorBalanceAfter - burnActorBalanceBefore, REGISTRATION_FEE, "Fee should be burned");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
pragma solidity ^0.8.20;

import {Test} from "forge-std/Test.sol";
import {MockFVMTest} from "@fvm-solidity/mocks/MockFVMTest.sol";
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ServiceProviderRegistry} from "../src/ServiceProviderRegistry.sol";
import {ServiceProviderRegistryStorage} from "../src/ServiceProviderRegistryStorage.sol";

contract ServiceProviderRegistryPaginationTest is Test {
contract ServiceProviderRegistryPaginationTest is MockFVMTest {
ServiceProviderRegistry public registry;

address public owner = address(0x1);
Expand All @@ -24,7 +24,8 @@ contract ServiceProviderRegistryPaginationTest is Test {
ServiceProviderRegistryStorage.PDPOffering public defaultPDPData;
bytes public encodedDefaultPDPData;

function setUp() public {
function setUp() public override {
super.setUp();
vm.startPrank(owner);

// Deploy implementation
Expand Down
Loading