Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
FedokDL committed Dec 19, 2024
1 parent 288f49c commit 79558d8
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions smart-contracts/contracts/delegate/DelegateFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ contract DelegateFactory is IDelegateFactory, OwnableUpgradeable, PausableUpgrad
uint256 fee_,
string memory name_,
string memory endpoint_,
uint128 deregistrationOpenAt
uint128 deregistrationOpensAt_
) external whenNotPaused returns (address) {
if (deregistrationOpenAt <= block.timestamp + minDeregistrationTimeout) {
revert InvalidDeregistrationOpenAt(deregistrationOpenAt, uint128(block.timestamp + minDeregistrationTimeout));
if (deregistrationOpensAt_ <= block.timestamp + minDeregistrationTimeout) {
revert InvalidDeregistrationOpenAt(deregistrationOpensAt_, uint128(block.timestamp + minDeregistrationTimeout));
}

bytes32 salt_ = _calculatePoolSalt(_msgSender());
Expand All @@ -74,7 +74,7 @@ contract DelegateFactory is IDelegateFactory, OwnableUpgradeable, PausableUpgrad
fee_,
name_,
endpoint_,
deregistrationOpenAt
deregistrationOpensAt_
);
IOwnable(proxy_).transferOwnership(_msgSender());

Expand Down
8 changes: 4 additions & 4 deletions smart-contracts/contracts/delegate/ProvidersDelegate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ contract ProvidersDelegate is IProvidersDelegate, OwnableUpgradeable {

// Deregistration limits
bool isDeregistered;
uint128 public deregistrationOpenAt;
uint128 public deregistrationOpensAt;

constructor() {
_disableInitializers();
Expand All @@ -51,7 +51,7 @@ contract ProvidersDelegate is IProvidersDelegate, OwnableUpgradeable {
uint256 fee_,
string memory name_,
string memory endpoint_,
uint128 deregistrationOpenAt_
uint128 deregistrationOpensAt_
) external initializer {
__Ownable_init();

Expand All @@ -67,7 +67,7 @@ contract ProvidersDelegate is IProvidersDelegate, OwnableUpgradeable {
}

fee = fee_;
deregistrationOpenAt = deregistrationOpenAt_;
deregistrationOpensAt = deregistrationOpensAt_;

IERC20(token).approve(lumerinDiamond_, type(uint256).max);
}
Expand Down Expand Up @@ -248,7 +248,7 @@ contract ProvidersDelegate is IProvidersDelegate, OwnableUpgradeable {
}

function isDeregisterAvailable() public view returns (bool) {
return block.timestamp >= deregistrationOpenAt;
return block.timestamp >= deregistrationOpensAt;
}

function _deleteModelBids(bytes32[] calldata bidIds_) private {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ interface IDelegateFactory {
* @param fee_ The fee percent where 100% = 10^25.
* @param name_ The Subnet name.
* @param endpoint_ The subnet endpoint.
* @param deregistrationOpenAt Provider deregistration will be available after this timestamp.
* @param deregistrationOpensAt_ Provider deregistration will be available after this timestamp.
* @return Deployed proxy address
*/
function deployProxy(
address feeTreasury_,
uint256 fee_,
string memory name_,
string memory endpoint_,
uint128 deregistrationOpenAt
uint128 deregistrationOpensAt_
) external returns (address);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ interface IProvidersDelegate {
* @param fee_ The fee percent where 100% = 10^25.
* @param name_ The Subnet name.
* @param endpoint_ The subnet endpoint.
* @param deregistrationOpenAt Provider deregistration will be available after this time.
* @param deregistrationOpensAt_ Provider deregistration will be available after this time.
*/
function ProvidersDelegate_init(
address lumerinDiamond_,
address feeTreasury_,
uint256 fee_,
string memory name_,
string memory endpoint_,
uint128 deregistrationOpenAt
uint128 deregistrationOpensAt_
) external;

/**
Expand Down
6 changes: 3 additions & 3 deletions smart-contracts/test/delegate/DelegateFactory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ describe('DelegateFactory', () => {
expect(await proxy.feeTreasury()).to.eq(KYLE);
expect(await proxy.name()).to.eq('name');
expect(await proxy.endpoint()).to.eq('endpoint');
expect(await proxy.deregistrationOpenAt()).to.eq(9998887771);
expect(await proxy.deregistrationOpensAt()).to.eq(9998887771);
});
it('should deploy new proxies', async () => {
await delegatorFactory.connect(SHEV).deployProxy(KYLE, wei(0.1, 25), 'name1', 'endpoint1', 9998887771);
Expand All @@ -124,15 +124,15 @@ describe('DelegateFactory', () => {
expect(await proxy.feeTreasury()).to.eq(SHEV);
expect(await proxy.name()).to.eq('name2');
expect(await proxy.endpoint()).to.eq('endpoint2');
expect(await proxy.deregistrationOpenAt()).to.eq(9998887772);
expect(await proxy.deregistrationOpensAt()).to.eq(9998887772);

proxy = providersDelegateFactory.attach(await delegatorFactory.proxies(KYLE, 0)) as ProvidersDelegate;
expect(await proxy.owner()).to.eq(KYLE);
expect(await proxy.fee()).to.eq(wei(0.3, 25));
expect(await proxy.feeTreasury()).to.eq(SHEV);
expect(await proxy.name()).to.eq('name3');
expect(await proxy.endpoint()).to.eq('endpoint3');
expect(await proxy.deregistrationOpenAt()).to.eq(9998887773);
expect(await proxy.deregistrationOpensAt()).to.eq(9998887773);
});
it('should throw error when fee is invalid', async () => {
await expect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const deployProvidersDelegate = async (
fee: BigNumberish,
name: string,
endpoint: string,
deregistrationOpenAt_: bigint | number,
deregistrationOpensAt_: bigint | number,
): Promise<ProvidersDelegate> => {
const [implFactory, proxyFactory] = await Promise.all([
ethers.getContractFactory('ProvidersDelegate'),
Expand All @@ -20,7 +20,7 @@ export const deployProvidersDelegate = async (
const proxy = await proxyFactory.deploy(impl, '0x');
const contract = implFactory.attach(proxy) as ProvidersDelegate;

await contract.ProvidersDelegate_init(diamond, feeTreasury, fee, name, endpoint, deregistrationOpenAt_);
await contract.ProvidersDelegate_init(diamond, feeTreasury, fee, name, endpoint, deregistrationOpensAt_);

return contract;
};

0 comments on commit 79558d8

Please sign in to comment.