Skip to content

Commit

Permalink
refactor(Implementation): dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
re1ro committed Oct 13, 2023
1 parent fa4b054 commit 9ea3c34
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion contracts/interfaces/IImplementation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

pragma solidity ^0.8.0;

interface IImplementation {
import { IContractIdentifier } from './IContractIdentifier.sol';

interface IImplementation is IContractIdentifier {
error NotProxy();
}
4 changes: 2 additions & 2 deletions contracts/interfaces/IUpgradable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
pragma solidity ^0.8.0;

import { IOwnable } from './IOwnable.sol';
import { IContractIdentifier } from './IContractIdentifier.sol';
import { IImplementation } from './IImplementation.sol';

// General interface for upgradable contracts
interface IUpgradable is IOwnable, IContractIdentifier {
interface IUpgradable is IOwnable, IImplementation {
error InvalidCodeHash();
error InvalidImplementation();
error SetupFailed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ contract TestImplementation is Implementation {
function setup(bytes calldata params) external override onlyProxy {
val = abi.decode(params, (uint256));
}

function contractId() external pure override returns (bytes32) {
return keccak256('TestImplementation');
}
}
2 changes: 0 additions & 2 deletions contracts/upgradable/Upgradable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { Implementation } from './Implementation.sol';
abstract contract Upgradable is Ownable, Implementation, IUpgradable {
// bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)
bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
address internal immutable implementationAddress;

/**
* @notice Constructor sets the implementation address to the address of the contract itself
Expand All @@ -23,7 +22,6 @@ abstract contract Upgradable is Ownable, Implementation, IUpgradable {
* set as the zero address because Ownable is designed to throw an error for ownership transfers to the zero address.
*/
constructor() Ownable(address(1)) {
implementationAddress = address(this);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/utils/Implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { defaultAbiCoder } = ethers.utils;
const { expect } = chai;
const { deployContract } = require('../utils.js');

const TestImplementation = require('../../artifacts/contracts/test/utils/TestImplementation.sol/TestImplementation.json');
const TestImplementation = require('../../artifacts/contracts/test/upgradable/TestImplementation.sol/TestImplementation.json');

let ownerWallet;
before(async () => {
Expand Down

0 comments on commit 9ea3c34

Please sign in to comment.