Skip to content

Commit

Permalink
rename the contract
Browse files Browse the repository at this point in the history
  • Loading branch information
backmeupplz committed Sep 6, 2022
1 parent 1bd81e5 commit a663e6b
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ uint256 constant contractLength = 42;
uint256 constant networkLength = 1;
uint256 constant zeroLength = 1;

contract ExternalSCERC721Ledger is SCERC721Ledger {
contract SCExternalERC721Ledger is SCERC721Ledger {
// State
address public immutable attestorEcdsaAddress;

Expand Down
4 changes: 2 additions & 2 deletions scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ async function main() {
defaultVerifierAddress: BALANCE_VERIFIER_CONTRACT_ADDRESS,
},
{
contractName: 'ExternalSCERC721Ledger',
contractName: 'SCExternalERC721Ledger',
defaultVerifierAddress: BALANCE_VERIFIER_CONTRACT_ADDRESS,
},
]
for (const { contractName, defaultVerifierAddress } of contracts) {
console.log(`Deploying ${contractName}...`)
const factory = await ethers.getContractFactory(contractName)
const isExternal = contractName === 'ExternalSCERC721Ledger'
const isExternal = contractName === 'SCExternalERC721Ledger'
const isEmail = contractName === 'SCEmailLedger'
const isFarcaster = contractName === 'SCFarcasterLedger'
const {
Expand Down
48 changes: 24 additions & 24 deletions test/ExternalSCERC721Ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ const mintFunctionSignatureWithOnlyProof =
const invalidEcdsaWallet = new ethers.Wallet(
'0x3931dc49c2615b436ed233b5f1bcba76cdc352f0318f8886d23f3e524e96a1be'
)
describe('ExternalSCERC721Ledger contract tests', () => {
describe('SCExternalERC721Ledger contract tests', () => {
before(async function () {
this.accounts = await ethers.getSigners()
this.owner = this.accounts[0]
this.user = this.accounts[1]
this.externalSCERC721LedgerFactory = await ethers.getContractFactory(
'ExternalSCERC721Ledger'
this.SCExternalERC721LedgerFactory = await ethers.getContractFactory(
'SCExternalERC721Ledger'
)
this.scERC721DerivativeFactory = await ethers.getContractFactory(
'SCERC721Derivative'
Expand All @@ -37,7 +37,7 @@ describe('ExternalSCERC721Ledger contract tests', () => {
})
describe('Constructor', function () {
it('should deploy the contract with the correct fields', async function () {
const contract = await this.externalSCERC721LedgerFactory.deploy(
const contract = await this.SCExternalERC721LedgerFactory.deploy(
zeroAddress,
attestorPublicKey,
zeroAddress,
Expand All @@ -63,8 +63,8 @@ describe('ExternalSCERC721Ledger contract tests', () => {
// ERC721
this.fakeERC721 = await getFakeERC721(this.owner)
// Ledger
this.externalSCERC721Ledger =
await this.externalSCERC721LedgerFactory.deploy(
this.SCExternalERC721Ledger =
await this.SCExternalERC721LedgerFactory.deploy(
this.fakeVerifierContract.address,
attestorPublicKey,
zeroAddress,
Expand All @@ -75,12 +75,12 @@ describe('ExternalSCERC721Ledger contract tests', () => {
)
this.name = 'MyERC721'
this.symbol = 'ME7'
await this.externalSCERC721Ledger.deployed()
this.externalSCERC721Ledger.connect(this.user)
await this.SCExternalERC721Ledger.deployed()
this.SCExternalERC721Ledger.connect(this.user)
})
it('should mint with ledger if all the correct info is there', async function () {
// Check the mint transaction
const tx = await this.externalSCERC721Ledger[mintFunctionSignature](
const tx = await this.SCExternalERC721Ledger[mintFunctionSignature](
getFakeBalanceProof(this.fakeERC721.address, Network.mainnet, 123, 1),
...(await getEcdsaArguments(
Network.mainnet,
Expand All @@ -91,7 +91,7 @@ describe('ExternalSCERC721Ledger contract tests', () => {
)
expect(await tx.wait())
// Get the derivative
const derivativeAddress = await this.externalSCERC721Ledger.getDerivative(
const derivativeAddress = await this.SCExternalERC721Ledger.getDerivative(
this.fakeERC721.address.toLowerCase()
)
const derivativeContract =
Expand All @@ -104,7 +104,7 @@ describe('ExternalSCERC721Ledger contract tests', () => {
})
it('should return correct metadata', async function () {
// Token mint
const tx = await this.externalSCERC721Ledger[mintFunctionSignature](
const tx = await this.SCExternalERC721Ledger[mintFunctionSignature](
getFakeBalanceProof(this.fakeERC721.address, Network.mainnet, 123, 1),
...(await getEcdsaArguments(
Network.mainnet,
Expand All @@ -115,7 +115,7 @@ describe('ExternalSCERC721Ledger contract tests', () => {
)
await tx.wait()
// Get the derivative
const derivativeAddress = await this.externalSCERC721Ledger.getDerivative(
const derivativeAddress = await this.SCExternalERC721Ledger.getDerivative(
this.fakeERC721.address.toLowerCase()
)
const derivativeContract =
Expand All @@ -135,7 +135,7 @@ describe('ExternalSCERC721Ledger contract tests', () => {
const name = '‡♦‰ℑℜ¤'
const symbol = '‡♦‰ℑℜ¤'
// Check the mint transaction
const tx = await this.externalSCERC721Ledger[mintFunctionSignature](
const tx = await this.SCExternalERC721Ledger[mintFunctionSignature](
getFakeBalanceProof(this.fakeERC721.address, Network.mainnet, 123, 1),
...(await getEcdsaArguments(
Network.mainnet,
Expand All @@ -147,7 +147,7 @@ describe('ExternalSCERC721Ledger contract tests', () => {
expect(await tx.wait())
// Get the derivative
const derivativeAddress =
await this.externalSCERC721Ledger.originalToDerivative(
await this.SCExternalERC721Ledger.originalToDerivative(
this.fakeERC721.address.toLowerCase()
)
const derivativeContract =
Expand All @@ -157,7 +157,7 @@ describe('ExternalSCERC721Ledger contract tests', () => {
expect(await derivativeContract.symbol()).to.equal(`${symbol}-d`)
})
it('should not mint without ecdsa signature', async function () {
const contract = await this.externalSCERC721LedgerFactory.deploy(
const contract = await this.SCExternalERC721LedgerFactory.deploy(
this.fakeVerifierContract.address,
attestorPublicKey,
zeroAddress,
Expand All @@ -176,7 +176,7 @@ describe('ExternalSCERC721Ledger contract tests', () => {
})
it('should not mint with ledger if the proof is incorrect', async function () {
await this.fakeVerifierContract.mock.verifyProof.returns(false)
const contract = await this.externalSCERC721LedgerFactory.deploy(
const contract = await this.SCExternalERC721LedgerFactory.deploy(
this.fakeVerifierContract.address,
attestorPublicKey,
zeroAddress,
Expand All @@ -199,7 +199,7 @@ describe('ExternalSCERC721Ledger contract tests', () => {
})
it('should not mint with ledger if the nullifier is incorrect', async function () {
// Check the mint transaction
await this.externalSCERC721Ledger[mintFunctionSignature](
await this.SCExternalERC721Ledger[mintFunctionSignature](
getFakeBalanceProof(this.fakeERC721.address, Network.mainnet, 123, 1),
...(await getEcdsaArguments(
Network.mainnet,
Expand All @@ -208,7 +208,7 @@ describe('ExternalSCERC721Ledger contract tests', () => {
this.symbol
))
)
const tx = this.externalSCERC721Ledger[mintFunctionSignature](
const tx = this.SCExternalERC721Ledger[mintFunctionSignature](
getFakeBalanceProof(this.fakeERC721.address, Network.mainnet, 123, 1),
...(await getEcdsaArguments(
Network.mainnet,
Expand All @@ -221,7 +221,7 @@ describe('ExternalSCERC721Ledger contract tests', () => {
})
it('should not mint with ledger if the name is empty', async function () {
// Check the mint transaction
const tx = this.externalSCERC721Ledger[mintFunctionSignature](
const tx = this.SCExternalERC721Ledger[mintFunctionSignature](
getFakeBalanceProof(this.fakeERC721.address, Network.mainnet, 123, 1),
...(await getEcdsaArguments(
Network.mainnet,
Expand All @@ -234,7 +234,7 @@ describe('ExternalSCERC721Ledger contract tests', () => {
})
it('should not mint with ledger if the symbol is empty', async function () {
// Check the mint transaction
const tx = this.externalSCERC721Ledger[mintFunctionSignature](
const tx = this.SCExternalERC721Ledger[mintFunctionSignature](
getFakeBalanceProof(this.fakeERC721.address, Network.mainnet, 123, 1),
...(await getEcdsaArguments(
Network.mainnet,
Expand All @@ -258,7 +258,7 @@ describe('ExternalSCERC721Ledger contract tests', () => {
)
ecdsaInput[1] = sig.r
ecdsaInput[2] = sig.yParityAndS
const tx = this.externalSCERC721Ledger[mintFunctionSignature](
const tx = this.SCExternalERC721Ledger[mintFunctionSignature](
getFakeBalanceProof(this.fakeERC721.address, Network.mainnet, 123, 1),
...ecdsaInput
)
Expand All @@ -280,7 +280,7 @@ describe('ExternalSCERC721Ledger contract tests', () => {
.reverse()
.join('')
.substring(0, ecdsaInput[1].length - 2)
const tx = this.externalSCERC721Ledger[mintFunctionSignature](
const tx = this.SCExternalERC721Ledger[mintFunctionSignature](
getFakeBalanceProof(this.fakeERC721.address, Network.mainnet, 123, 1),
...ecdsaInput
)
Expand All @@ -290,7 +290,7 @@ describe('ExternalSCERC721Ledger contract tests', () => {
})
it('should not mint with ledger if the network is incorrect', async function () {
// Check the mint transaction
const tx = this.externalSCERC721Ledger[mintFunctionSignature](
const tx = this.SCExternalERC721Ledger[mintFunctionSignature](
getFakeBalanceProof(this.fakeERC721.address, Network.goerli, 123, 1),
...(await getEcdsaArguments(
Network.goerli,
Expand All @@ -303,7 +303,7 @@ describe('ExternalSCERC721Ledger contract tests', () => {
})
it('should not mint with ledger if the token address is incorrect', async function () {
// Check the mint transaction
const tx = this.externalSCERC721Ledger[mintFunctionSignature](
const tx = this.SCExternalERC721Ledger[mintFunctionSignature](
getFakeBalanceProof(this.fakeERC721.address, Network.mainnet, 123, 1),
...(await getEcdsaArguments(
Network.mainnet,
Expand Down
8 changes: 4 additions & 4 deletions test/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { MockContract } from 'ethereum-waffle'
import type { SignerWithAddress } from '@nomiclabs/hardhat-ethers/dist/src/signer-with-address'

import type {
ExternalSCERC721Ledger,
ExternalSCERC721Ledger__factory,
SCExternalERC721Ledger,
SCExternalERC721Ledger__factory,
Ledger,
SCERC721Derivative,
SCERC721Derivative__factory,
Expand All @@ -18,13 +18,13 @@ import type {
declare module 'mocha' {
export interface Context {
// Facoriries for contracts
externalSCERC721LedgerFactory: ExternalSCERC721Ledger__factory
SCExternalERC721LedgerFactory: SCExternalERC721Ledger__factory
scEmailLedgerFactory: SCEmailLedger__factory
scERC721LedgerFactory: SCERC721Ledger__factory
scERC721DerivativeFactory: SCERC721Derivative__factory
scEmailDerivativeFactory: SCEmailDerivative__factory
// Contract instances
externalSCERC721Ledger: ExternalSCERC721Ledger
SCExternalERC721Ledger: SCExternalERC721Ledger
scEmailLedger: SCEmailLedger
scERC721Ledger: SCERC721Ledger
scERC721Derivative: SCERC721Derivative
Expand Down
2 changes: 1 addition & 1 deletion test/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BalanceProofStruct } from 'typechain/contracts/ExternalSCERC721Ledger'
import { BalanceProofStruct } from 'typechain/contracts/SCExternalERC721Ledger'
import { BigNumber, Wallet, ethers } from 'ethers'
import { EmailProofStruct } from 'typechain/contracts/SCEmailLedger'
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'
Expand Down

0 comments on commit a663e6b

Please sign in to comment.