Skip to content

Commit

Permalink
chore: rename contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
shenshin committed Oct 25, 2024
1 parent 2904e61 commit 489f003
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.20;

import {ERC721UpgradableBase} from "./ERC721UpgradableBase.sol";
import {ERC721BaseUpgradable} from "./ERC721BaseUpgradable.sol";

struct AirdropRecipient {
address receiver;
Expand All @@ -19,7 +19,7 @@ interface IAirdroppable {
function airdrop(AirdropRecipient[] calldata receivers) external;
}

abstract contract ERC721UpgradableAirdroppable is ERC721UpgradableBase, IAirdroppable {
abstract contract ERC721AirdroppableUpgradable is ERC721BaseUpgradable, IAirdroppable {
error AirdropMintingLocked(uint256 numMinted);

event AirDropLocked(uint256 numMinted);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {ERC721URIStorageUpgradeable} from "@openzeppelin/contracts-upgradeable/t
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";

abstract contract ERC721UpgradableBase is
abstract contract ERC721BaseUpgradable is
Initializable,
ERC721Upgradeable,
ERC721EnumerableUpgradeable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ pragma solidity ^0.8.20;

import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import {ERC721UpgradableBase} from "./ERC721UpgradableBase.sol";
import {ERC721BaseUpgradable} from "./ERC721BaseUpgradable.sol";

abstract contract ERC721UpgradableNonTransferrable is ERC721UpgradableBase {
abstract contract ERC721NonTransferrableUpgradable is ERC721BaseUpgradable {
error TransfersDisabled();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,17 @@ pragma solidity ^0.8.20;

import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import {ERC721UpgradableAirdroppable} from "./ERC721UpgradableAirdroppable.sol";
import {ERC721UpgradableNonTransferrable} from "./ERC721UpgradableNonTransferrable.sol";
import {ERC721AirdroppableUpgradable} from "./ERC721AirdroppableUpgradable.sol";
import {ERC721NonTransferrableUpgradable} from "./ERC721NonTransferrableUpgradable.sol";

contract ExternalContributorsEcosystemPartner is
ERC721UpgradableAirdroppable,
ERC721UpgradableNonTransferrable
{
contract OGContributorsRootstockCollective is ERC721AirdroppableUpgradable, ERC721NonTransferrableUpgradable {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}

function initialize(address initialOwner) public initializer {
__ERC721UpgradableBase_init("OGExternalContributorsEcosystemPartner", "OGECEP", initialOwner);
__ERC721UpgradableBase_init("OGContributorsRootstockCollective", "OGC", initialOwner);
}

function _authorizeUpgrade(address newImplementation) internal virtual override onlyOwner {}
Expand All @@ -30,22 +27,22 @@ contract ExternalContributorsEcosystemPartner is
function approve(
address to,
uint256 tokenId
) public virtual override(IERC721, ERC721Upgradeable, ERC721UpgradableNonTransferrable) {
) public virtual override(IERC721, ERC721Upgradeable, ERC721NonTransferrableUpgradable) {
super.approve(to, tokenId);
}

function setApprovalForAll(
address operator,
bool approved
) public virtual override(IERC721, ERC721Upgradeable, ERC721UpgradableNonTransferrable) {
) public virtual override(IERC721, ERC721Upgradeable, ERC721NonTransferrableUpgradable) {
super.setApprovalForAll(operator, approved);
}

function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override(IERC721, ERC721Upgradeable, ERC721UpgradableNonTransferrable) {
) public virtual override(IERC721, ERC721Upgradeable, ERC721NonTransferrableUpgradable) {
super.transferFrom(from, to, tokenId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ pragma solidity ^0.8.20;
import {IVotes} from "@openzeppelin/contracts/governance/utils/IVotes.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";

import {ERC721UpgradableNonTransferrable} from "./ERC721UpgradableNonTransferrable.sol";
import {ERC721NonTransferrableUpgradable} from "./ERC721NonTransferrableUpgradable.sol";

contract OGFounders is ERC721UpgradableNonTransferrable {
contract OGFoundersRootstockCollective is ERC721NonTransferrableUpgradable {
using Strings for uint8;

error WasNotEnoughStRIFToMint(uint stRIF);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ pragma solidity ^0.8.20;

import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import {ERC721UpgradableAirdroppable} from "./ERC721UpgradableAirdroppable.sol";
import {ERC721UpgradableNonTransferrable} from "./ERC721UpgradableNonTransferrable.sol";
import {ERC721AirdroppableUpgradable} from "./ERC721AirdroppableUpgradable.sol";
import {ERC721NonTransferrableUpgradable} from "./ERC721NonTransferrableUpgradable.sol";

contract OgFoundersEcosystemPartner is ERC721UpgradableAirdroppable, ERC721UpgradableNonTransferrable {
contract OGPartnersRootstockCollective is ERC721AirdroppableUpgradable, ERC721NonTransferrableUpgradable {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}

function initialize(address initialOwner) public initializer {
__ERC721UpgradableBase_init("OgFoundersEcosystemPartner", "OGFEP", initialOwner);
__ERC721UpgradableBase_init("OGPartnersRootstockCollective", "OGP", initialOwner);
}

function _authorizeUpgrade(address newImplementation) internal virtual override onlyOwner {}
Expand All @@ -28,22 +28,22 @@ contract OgFoundersEcosystemPartner is ERC721UpgradableAirdroppable, ERC721Upgra
function approve(
address to,
uint256 tokenId
) public virtual override(IERC721, ERC721Upgradeable, ERC721UpgradableNonTransferrable) {
) public virtual override(IERC721, ERC721Upgradeable, ERC721NonTransferrableUpgradable) {
super.approve(to, tokenId);
}

function setApprovalForAll(
address operator,
bool approved
) public virtual override(IERC721, ERC721Upgradeable, ERC721UpgradableNonTransferrable) {
) public virtual override(IERC721, ERC721Upgradeable, ERC721NonTransferrableUpgradable) {
super.setApprovalForAll(operator, approved);
}

function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override(IERC721, ERC721Upgradeable, ERC721UpgradableNonTransferrable) {
) public virtual override(IERC721, ERC721Upgradeable, ERC721NonTransferrableUpgradable) {
super.transferFrom(from, to, tokenId);
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { buildModule } from '@nomicfoundation/hardhat-ignition/modules'

export const extContributersEpProxyModule = buildModule('ExtContributorsEP', m => {
export const ogContributorsModule = buildModule('OGContributors', m => {
// deploy implementation
const implementation = m.contract('ExternalContributorsEcosystemPartner', [], { id: 'Implementation' })
const implementation = m.contract('OGContributorsRootstockCollective', [], { id: 'Implementation' })

const deployer = m.getAccount(0)
// deploy proxy
Expand All @@ -12,11 +12,11 @@ export const extContributersEpProxyModule = buildModule('ExtContributorsEP', m =
id: 'Proxy',
}),
])
const ExtContributorsEP = m.contractAt('ExternalContributorsEcosystemPartner', proxy, {
const ExtContributorsEP = m.contractAt('OGContributorsRootstockCollective', proxy, {
id: 'Contract',
})

return { ExtContributorsEP }
})

export default extContributersEpProxyModule
export default ogContributorsModule
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { buildModule } from '@nomicfoundation/hardhat-ignition/modules'

export const OGFoundersProxyModule = buildModule('OGFounders', m => {
export const OGFoundersModule = buildModule('OGFounders', m => {
// deploy implementation
const implementation = m.contract('OGFounders', [], { id: 'Implementation' })
const implementation = m.contract('OGFoundersRootstockCollective', [], { id: 'Implementation' })

// initializer parameters
const deployer = m.getAccount(0)
Expand All @@ -16,11 +16,11 @@ export const OGFoundersProxyModule = buildModule('OGFounders', m => {
id: 'Proxy',
}),
])
const OGFounders = m.contractAt('OGFounders', proxy, {
const OGFounders = m.contractAt('OGFoundersRootstockCollective', proxy, {
id: 'Contract',
})

return { OGFounders }
})

export default OGFoundersProxyModule
export default OGFoundersModule
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { buildModule } from '@nomicfoundation/hardhat-ignition/modules'

export const ogFoundersEpProxyModule = buildModule('OgFoundersEP', m => {
export const ogPartnersModule = buildModule('OGPartners', m => {
// deploy implementation
const implementation = m.contract('OgFoundersEcosystemPartner', [], { id: 'Implementation' })
const implementation = m.contract('OGPartnersRootstockCollective', [], { id: 'Implementation' })

// initializer parameters
const deployer = m.getAccount(0)
Expand All @@ -14,11 +14,11 @@ export const ogFoundersEpProxyModule = buildModule('OgFoundersEP', m => {
id: 'Proxy',
}),
])
const ogFoundersEp = m.contractAt('OgFoundersEcosystemPartner', proxy, {
const ogFoundersEp = m.contractAt('OGPartnersRootstockCollective', proxy, {
id: 'Contract',
})

return { ogFoundersEp }
})

export default ogFoundersEpProxyModule
export default ogPartnersModule
10 changes: 5 additions & 5 deletions test/Governor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import {
StRIFToken,
DaoTimelockUpgradableRootstockCollective,
ProposalTarget,
OGFounders,
OGFoundersRootstockCollective,
} from '../typechain-types'
import { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers'
import { ContractTransactionResponse, parseEther, solidityPackedKeccak256 } from 'ethers'
import { Proposal, ProposalState, OperationState } from '../types'
import { deployContracts } from './deployContracts'
import ogFoundersProxyModule from '../ignition/modules/OGFounders'
import ogFoundersModule from '../ignition/modules/OGFoundersModule'

describe('Governor Contact', () => {
const initialVotingDelay = 1n
Expand Down Expand Up @@ -233,19 +233,19 @@ describe('Governor Contact', () => {
})

describe('OG Founders NFT', () => {
let ogFoundersNFT: OGFounders
let ogFoundersNFT: OGFoundersRootstockCollective
let tokensLeft = 150

before(async () => {
const contract = await ignition.deploy(ogFoundersProxyModule, {
const contract = await ignition.deploy(ogFoundersModule, {
parameters: {
OGFounders: {
stRIFAddress: await stRIF.getAddress(),
firstProposalDate: proposalSnapshot,
},
},
})
ogFoundersNFT = contract.OGFounders as unknown as OGFounders
ogFoundersNFT = contract.OGFounders as unknown as OGFoundersRootstockCollective
})

it('the OG Founders NFT should be deployed', async () => {
Expand Down
23 changes: 12 additions & 11 deletions test/ExtContributorsEP.test.ts → test/OGContributors.test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { expect } from 'chai'
import hre, { ethers, ignition } from 'hardhat'
import { ExternalContributorsEcosystemPartner } from '../typechain-types'
import { OGContributorsRootstockCollective } from '../typechain-types'
import { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers'
import { extContributersEpProxyModule } from '../ignition/modules/ExternalContributorsEcosystemPartner'
import { ogContributorsModule } from '../ignition/modules/OGContributorsModule'
import airdropReceivers from '../params/ExtContributorsEP/airdrop-testnet.json'

describe('ExternalContributorsEcosystemPartner NFT', () => {
describe('OGContributorsRootstockCollective NFT', () => {
let deployer: SignerWithAddress
let alice: SignerWithAddress
const orgGangsters: SignerWithAddress[] = []
let extContEP: ExternalContributorsEcosystemPartner
let extContEP: OGContributorsRootstockCollective

before(async () => {
;[deployer, alice] = await ethers.getSigners()
const contract = await ignition.deploy(extContributersEpProxyModule)
extContEP = contract.ExtContributorsEP as unknown as ExternalContributorsEcosystemPartner
const contract = await ignition.deploy(ogContributorsModule)
extContEP = contract.ExtContributorsEP as unknown as OGContributorsRootstockCollective
// impersonating airdrop receivers
for (let i = 0; i < airdropReceivers.length; i++) {
const accountAddr = airdropReceivers[i].receiver
Expand All @@ -29,8 +29,8 @@ describe('ExternalContributorsEcosystemPartner NFT', () => {

describe('Upon deployment', () => {
it('should set up proper NFT name and symbol', async () => {
expect(await extContEP.connect(deployer).name()).to.equal("OGExternalContributorsEcosystemPartner")
expect(await extContEP.symbol()).to.equal("OGECEP")
expect(await extContEP.connect(deployer).name()).to.equal('OGContributorsRootstockCollective')
expect(await extContEP.symbol()).to.equal('OGC')
})

it('should have zero total supply', async () => {
Expand Down Expand Up @@ -98,9 +98,10 @@ describe('ExternalContributorsEcosystemPartner NFT', () => {
it('approvals should be forbidden', async () => {
await Promise.all(
orgGangsters.map(async (sender, i) => {
await expect(
extContEP.connect(sender).approve(alice.address, i + 1),
).to.be.revertedWithCustomError(extContEP, 'TransfersDisabled')
await expect(extContEP.connect(sender).approve(alice.address, i + 1)).to.be.revertedWithCustomError(
extContEP,
'TransfersDisabled',
)
}),
)
})
Expand Down
16 changes: 8 additions & 8 deletions test/OgFoundersEP.test.ts → test/OGPartners.test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { expect } from 'chai'
import hre, { ethers, ignition } from 'hardhat'
import { OgFoundersEcosystemPartner } from '../typechain-types'
import { OGPartnersRootstockCollective } from '../typechain-types'
import { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers'
import { ogFoundersEpProxyModule } from '../ignition/modules/OgFoundersEP'
import { ogPartnersModule } from '../ignition/modules/OGPartnersModule'
import airdropReceivers from '../params/OgFoundersEP/airdrop-testnet.json'

describe('OgFoundersEcosystemPartner NFT', () => {
describe('OGPartnersRootstockCollective NFT', () => {
let deployer: SignerWithAddress
let alice: SignerWithAddress
const oldGangsters: SignerWithAddress[] = []
let ogFoundersEp: OgFoundersEcosystemPartner
let ogFoundersEp: OGPartnersRootstockCollective

before(async () => {
;[deployer, alice] = await ethers.getSigners()
const contract = await ignition.deploy(ogFoundersEpProxyModule)
ogFoundersEp = contract.ogFoundersEp as unknown as OgFoundersEcosystemPartner
const contract = await ignition.deploy(ogPartnersModule)
ogFoundersEp = contract.ogFoundersEp as unknown as OGPartnersRootstockCollective
// impersonating airdrop receivers
for (let i = 0; i < airdropReceivers.length; i++) {
const accountAddr = airdropReceivers[i].receiver
Expand All @@ -29,8 +29,8 @@ describe('OgFoundersEcosystemPartner NFT', () => {

describe('Upon deployment', () => {
it('should set up proper NFT name and symbol', async () => {
expect(await ogFoundersEp.connect(deployer).name()).to.equal('OgFoundersEcosystemPartner')
expect(await ogFoundersEp.symbol()).to.equal('OGFEP')
expect(await ogFoundersEp.connect(deployer).name()).to.equal('OGPartnersRootstockCollective')
expect(await ogFoundersEp.symbol()).to.equal('OGP')
})

it('should have zero total supply', async () => {
Expand Down

0 comments on commit 489f003

Please sign in to comment.