Skip to content

Commit 042e1e4

Browse files
committed
conflicts resolve
1 parent 628a55e commit 042e1e4

File tree

4 files changed

+10
-128
lines changed

4 files changed

+10
-128
lines changed

abis/Client.json

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -399,19 +399,6 @@
399399
"outputs": [],
400400
"stateMutability": "payable"
401401
},
402-
{
403-
"type": "event",
404-
"name": "DatacapAllocated",
405-
"inputs": [
406-
{
407-
"name": "allowance",
408-
"type": "uint256",
409-
"indexed": true,
410-
"internalType": "uint256"
411-
}
412-
],
413-
"anonymous": false
414-
},
415402
{
416403
"type": "event",
417404
"name": "DatacapSpent",
@@ -532,44 +519,6 @@
532519
],
533520
"anonymous": false
534521
},
535-
{
536-
"type": "event",
537-
"name": "ValidatorLockupPeriodUpdated",
538-
"inputs": [
539-
{
540-
"name": "dealId",
541-
"type": "uint256",
542-
"indexed": true,
543-
"internalType": "uint256"
544-
},
545-
{
546-
"name": "validator",
547-
"type": "address",
548-
"indexed": true,
549-
"internalType": "address"
550-
}
551-
],
552-
"anonymous": false
553-
},
554-
{
555-
"type": "event",
556-
"name": "VerifiedClientAdded",
557-
"inputs": [
558-
{
559-
"name": "client",
560-
"type": "address",
561-
"indexed": true,
562-
"internalType": "address"
563-
},
564-
{
565-
"name": "allowance",
566-
"type": "uint256",
567-
"indexed": true,
568-
"internalType": "uint256"
569-
}
570-
],
571-
"anonymous": false
572-
},
573522
{
574523
"type": "error",
575524
"name": "AccessControlBadConfirmation",
@@ -648,11 +597,6 @@
648597
"name": "InvalidAllocationRequest",
649598
"inputs": []
650599
},
651-
{
652-
"type": "error",
653-
"name": "InvalidAllocatorAddress",
654-
"inputs": []
655-
},
656600
{
657601
"type": "error",
658602
"name": "InvalidCaller",

script/Deploy.s.sol

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ contract Deploy is Script, DeployUtils {
5858
(validatorFactory, validatorFactoryImpl, validatorImpl) = _deployValidatorFactory(admin);
5959
(poRepMarket, poRepMarketImpl) = _deployPoRepMarket(admin, validatorFactory, spRegistry);
6060
(clientSmartContract, clientSmartContractImpl) =
61-
_deployClientSmartContract(admin, allocator, terminationOracle, poRepMarket, metaAllocator);
61+
_deployClientSmartContract(admin, terminationOracle, poRepMarket, metaAllocator);
6262
(sliOracle, sliOracleImpl) = _deploySLIOracle(admin, oracleAddress);
6363
(sliScorer, sliScorerImpl) = _deploySliScorer(admin, sliOracle);
6464
(spRegistry, spRegistryImpl) = _deploySPRegistry(admin);
@@ -107,14 +107,13 @@ contract Deploy is Script, DeployUtils {
107107

108108
function _deployClientSmartContract(
109109
address _admin,
110-
address _allocator,
111110
address _terminationOracle,
112111
address _porepMarket,
113112
address _metaAllocator
114113
) internal returns (address proxy, address impl) {
115114
Client _impl = new Client();
116115
bytes memory init =
117-
abi.encodeCall(Client.initialize, (_admin, _allocator, _terminationOracle, _porepMarket, _metaAllocator));
116+
abi.encodeCall(Client.initialize, (_admin, _terminationOracle, _porepMarket, _metaAllocator));
118117
proxy = createProxy(init, address(_impl));
119118
impl = address(_impl);
120119
}
@@ -158,7 +157,6 @@ contract Deploy is Script, DeployUtils {
158157
json.serialize("ValidatorBeacon", validatorBeacon);
159158
json.serialize("ValidatorImpl", validatorImpl);
160159
json.serialize("FilecoinPay", filecoinPay);
161-
json.serialize("Allocator", allocator);
162160
json.serialize("PoRepService", poRepService);
163161
json.serialize("MetaAllocator", metaAllocator);
164162
json.serialize("SPRegistry", spRegistry);

src/Client.sol

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ contract Client is Initializable, AccessControlUpgradeable, UUPSUpgradeable, Ree
7676
event DatacapSpent(address indexed client, uint256 amount);
7777
// solhint-enable gas-indexed-events
7878

79-
/**
80-
* @notice Emitted when a datacap is successfully allocated to client contract
81-
* @param allowance Allowance amount
82-
*/
83-
event DatacapAllocated(uint256 indexed allowance);
84-
8579
/**
8680
* @notice Thrown if sender is not proposed client
8781
*/
@@ -147,11 +141,6 @@ contract Client is Initializable, AccessControlUpgradeable, UUPSUpgradeable, Ree
147141
*/
148142
error InvalidAdminAddress();
149143

150-
/**
151-
* @notice Error thrown when invalid allocator address is provided
152-
*/
153-
error InvalidAllocatorAddress();
154-
155144
/**
156145
* @notice Error thrown when invalid termination oracle address is provided
157146
*/
@@ -204,12 +193,11 @@ contract Client is Initializable, AccessControlUpgradeable, UUPSUpgradeable, Ree
204193
*/
205194
function initialize(
206195
address admin,
207-
address allocator,
208196
address terminationOracle,
209197
address _poRepMarketContract,
210198
address _metaAllocatorContract
211199
) public initializer {
212-
_validateInitializeAddresses(admin, allocator, terminationOracle, _poRepMarketContract, _metaAllocatorContract);
200+
_validateInitializeAddresses(admin, terminationOracle, _poRepMarketContract, _metaAllocatorContract);
213201

214202
__AccessControl_init();
215203
_grantRole(DEFAULT_ADMIN_ROLE, admin);
@@ -224,24 +212,19 @@ contract Client is Initializable, AccessControlUpgradeable, UUPSUpgradeable, Ree
224212
/**
225213
* @notice Validates the addresses passed to the initialize function
226214
* @param admin Contract owner
227-
* @param allocator Address of the allocator contract that can increase and decrease allowances
228215
* @param terminationOracle Address of the Termination Oracle
229216
* @param poRepMarketContract Address of the PoRepMarket contract
230217
* @param metaAllocatorContract Address of the MetaAllocator contract
231218
*/
232219
function _validateInitializeAddresses(
233220
address admin,
234-
address allocator,
235221
address terminationOracle,
236222
address poRepMarketContract,
237223
address metaAllocatorContract
238224
) internal pure {
239225
if (admin == address(0)) {
240226
revert InvalidAdminAddress();
241227
}
242-
if (allocator == address(0)) {
243-
revert InvalidAllocatorAddress();
244-
}
245228
if (terminationOracle == address(0)) {
246229
revert InvalidTerminationOracleAddress();
247230
}
@@ -279,7 +262,7 @@ contract Client is Initializable, AccessControlUpgradeable, UUPSUpgradeable, Ree
279262
uint256 sizeOfAllocations = _verifyAndRegisterAllocations(dealId, allocations);
280263
uint256 sizeOfClaims = _verifyAndRegisterClaimExtensions(dealId, claimExtensions);
281264
uint256 allocationsAndClaimsSize = sizeOfAllocations + sizeOfClaims;
282-
$._metaAllocatorContract
265+
$._metaAllocatorContract
283266
.addVerifiedClient(FilAddresses.fromEthAddress(address(this)).data, allocationsAndClaimsSize);
284267

285268
emit DatacapSpent(msg.sender, allocationsAndClaimsSize);

test/Client.t.sol

Lines changed: 6 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ contract ClientTest is Test {
134134
function setupProxy(address impl) public returns (address) {
135135
// solhint-disable-next-line gas-small-strings
136136
bytes memory initData = abi.encodeCall(
137-
Client.initialize,
138-
(address(this), allocator, terminationOracle, address(poRepMarketMock), address(metaAllocatorMock))
137+
Client.initialize, (address(this), terminationOracle, address(poRepMarketMock), address(metaAllocatorMock))
139138
);
140139
ERC1967Proxy proxy = new ERC1967Proxy(address(impl), initData);
141140
return address(proxy);
@@ -821,24 +820,7 @@ contract ClientTest is Test {
821820
Client c = Client(address(proxy));
822821

823822
vm.expectRevert(abi.encodeWithSelector(Client.InvalidAdminAddress.selector));
824-
c.initialize(
825-
address(0),
826-
address(metaAllocatorMock),
827-
terminationOracle,
828-
address(poRepMarketMock),
829-
address(metaAllocatorMock)
830-
);
831-
}
832-
833-
function testInitializeRevertsWhenAllocatorIsZero() public {
834-
Client impl = new Client();
835-
ERC1967Proxy proxy = new ERC1967Proxy(address(impl), "");
836-
Client c = Client(address(proxy));
837-
838-
vm.expectRevert(abi.encodeWithSelector(Client.InvalidAllocatorAddress.selector));
839-
c.initialize(
840-
address(clientAddress), address(0), terminationOracle, address(poRepMarketMock), address(metaAllocatorMock)
841-
);
823+
c.initialize(address(0), terminationOracle, address(poRepMarketMock), address(metaAllocatorMock));
842824
}
843825

844826
function testInitializeRevertsWhenTerminationOracleIsZero() public {
@@ -847,13 +829,7 @@ contract ClientTest is Test {
847829
Client c = Client(address(proxy));
848830

849831
vm.expectRevert(abi.encodeWithSelector(Client.InvalidTerminationOracleAddress.selector));
850-
c.initialize(
851-
address(clientAddress),
852-
address(metaAllocatorMock),
853-
address(0),
854-
address(poRepMarketMock),
855-
address(metaAllocatorMock)
856-
);
832+
c.initialize(address(clientAddress), address(0), address(poRepMarketMock), address(metaAllocatorMock));
857833
}
858834

859835
function testInitializeRevertsWhenPoRepMarketIsZero() public {
@@ -862,13 +838,7 @@ contract ClientTest is Test {
862838
Client c = Client(address(proxy));
863839

864840
vm.expectRevert(abi.encodeWithSelector(Client.InvalidPoRepMarketContractAddress.selector));
865-
c.initialize(
866-
address(clientAddress),
867-
address(metaAllocatorMock),
868-
terminationOracle,
869-
address(0),
870-
address(metaAllocatorMock)
871-
);
841+
c.initialize(address(clientAddress), terminationOracle, address(0), address(metaAllocatorMock));
872842
}
873843

874844
function testInitializeRevertsWhenMetaAllocatorIsZero() public {
@@ -877,11 +847,9 @@ contract ClientTest is Test {
877847
Client c = Client(address(proxy));
878848

879849
vm.expectRevert(abi.encodeWithSelector(Client.InvalidMetaAllocatorContractAddress.selector));
880-
c.initialize(
881-
address(clientAddress), address(metaAllocatorMock), terminationOracle, address(poRepMarketMock), address(0)
882-
);
850+
c.initialize(address(clientAddress), terminationOracle, address(poRepMarketMock), address(0));
883851
}
884-
852+
885853
function testShouldRevertWhenAlreadyRegisteredDealTransferIsCalledByNotTheClient() public {
886854
vm.prank(clientAddress);
887855
client.transfer(transferParams, dealId, false);
@@ -902,15 +870,4 @@ contract ClientTest is Test {
902870
vm.prank(clientAddress);
903871
client.transfer(transferParams, dealId, false);
904872
}
905-
906-
function testTransferEmitsDatacapAllocated() public {
907-
transferParams.operator_data =
908-
hex"828186192710D82A5828000181E203922020F2B9A58BBC9D9856E52EAB85155C1BA298F7E8DF458BD20A3AD767E11572CA221908001A0007E9001A005033401901318183192710031A005034AC";
909-
910-
vm.expectEmit(true, false, false, false);
911-
emit Client.DatacapAllocated(4096);
912-
913-
vm.prank(clientAddress);
914-
client.transfer(transferParams, dealId, false);
915-
}
916873
}

0 commit comments

Comments
 (0)