Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix: truffle; use _overrideConnectMethod in toInstance #46

Merged
merged 45 commits into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b8deedf
refactoring
RuslanProgrammer Oct 23, 2023
775a6b5
Merge pull request #40 from dl-solarity/bug/bugs
KyrylR Oct 23, 2023
60295d4
use wait instead of confirmations in the config
RuslanProgrammer Oct 25, 2023
8442323
change 'verify' parameter to the boolean flag
RuslanProgrammer Oct 25, 2023
b77e757
removed 'skipVerificationErrors' from config
RuslanProgrammer Oct 25, 2023
6743cf3
updated readme and help task
RuslanProgrammer Oct 25, 2023
ddd7fba
fixed attempts ussage during verification
RuslanProgrammer Oct 25, 2023
db6bd22
drafts of verify task
RuslanProgrammer Oct 25, 2023
20739dd
added 'chainId' to verifier
RuslanProgrammer Oct 25, 2023
928c704
deleting .storage if continiue == false
RuslanProgrammer Oct 25, 2023
90f76b0
added 'contractAddress' as optimial parameter to deployed()
RuslanProgrammer Oct 25, 2023
00c7c63
Review
KyrylR Oct 26, 2023
5d3e0f6
fixed verify task
RuslanProgrammer Oct 26, 2023
cd58040
applied wait for reporter
RuslanProgrammer Oct 26, 2023
5e947cd
fixed scope
RuslanProgrammer Oct 26, 2023
9882f20
added Handler inception to contracts factory (#41)
RuslanProgrammer Oct 27, 2023
64c79c3
added sendNative() (#43)
RuslanProgrammer Oct 27, 2023
1ce274e
Merge remote-tracking branch 'origin/develop' into fix/small-changes
RuslanProgrammer Oct 27, 2023
b555a98
config
RuslanProgrammer Oct 27, 2023
5a16060
Merge remote-tracking branch 'origin/develop' into fix/small-changes
RuslanProgrammer Oct 27, 2023
ffea2e2
fixed types
RuslanProgrammer Oct 27, 2023
798f9f6
added info to formatPendingTime()
RuslanProgrammer Oct 27, 2023
f5a5a2f
fixed verifier
RuslanProgrammer Oct 27, 2023
eefbd59
Sorted out imports
KyrylR Oct 27, 2023
c6e72a9
Used plain ethers for ContractFactory
KyrylR Oct 27, 2023
daae823
Drop direct ethers. Used custom provider instead.
KyrylR Oct 27, 2023
cccdd37
added 'address' property to BaseContract
RuslanProgrammer Oct 27, 2023
27378b3
Merge pull request #45 from dl-solarity/fix/small-changes
KyrylR Oct 27, 2023
42f5765
Deleted redundant VerificationProcessor
KyrylR Oct 27, 2023
5f810b6
Mentioned some insights
KyrylR Oct 27, 2023
f134b98
updated package.json
RuslanProgrammer Oct 27, 2023
6985038
Fixed bug with config
KyrylR Oct 27, 2023
de0bac3
Merge remote-tracking branch 'origin/develop' into develop
KyrylR Oct 27, 2023
a7f4791
Fixed UX reporter
KyrylR Oct 27, 2023
e50ed00
Refactored redundant setAsDeployed
KyrylR Oct 27, 2023
35d3f56
Clarified names
KyrylR Oct 27, 2023
5330ce1
trying get deployed contract by name first
RuslanProgrammer Oct 27, 2023
1fbf566
refactored
RuslanProgrammer Oct 27, 2023
5d310d3
Clarified names
KyrylR Oct 27, 2023
00b8955
Drop overbalanced logic
KyrylR Oct 27, 2023
b5724cc
Merge remote-tracking branch 'origin/develop' into develop
KyrylR Oct 27, 2023
a728339
Further renaming
KyrylR Oct 27, 2023
d488775
Clean up: encapsulation + fix bug in truffle
KyrylR Oct 28, 2023
afaab56
Merge branch 'master' into develop
KyrylR Oct 28, 2023
210ec2e
Updated versions
KyrylR Oct 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30,800 changes: 12,428 additions & 18,372 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solarity/hardhat-migrate",
"version": "2.0.0-alpha.3",
"version": "2.0.0-alpha.4",
"description": "Automatic deployment and verification of smart contracts",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down Expand Up @@ -35,7 +35,7 @@
"prepack": "pinst --disable",
"postpack": "pinst --enable",
"build": "tsc --build .",
"test": "mocha --recursive 'test/**/*.ts' --exit",
"test": "mocha --recursive 'test/**/*.ts' --exit && npm run lint-fix",
"lint-fix": "prettier --write \"./**/*.ts\" && eslint \"src/**/*.{js,ts}\" --cache --fix",
"publish-to-npm": "npm run build && npm run lint-fix && npm publish ./ --access public"
},
Expand Down
8 changes: 4 additions & 4 deletions src/deployer/adapters/AbstractEthersAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ export abstract class AbstractEthersAdapter extends Adapter {
if (!AbstractEthersAdapter._processedClasses.has(contractName)) {
AbstractEthersAdapter._processedClasses.add(contractName);

await this.overrideConnectMethod(instance, contractName);
await this._overrideConnectMethod(instance, contractName);
}

this._insertAddressGetter(contract, address);
return this.insertHandlers(contract, contractName, parameters) as unknown as I;
return this._insertHandlers(contract, contractName, parameters) as unknown as I;
}

public insertHandlers(contract: BaseContract, contractName: string, parameters: OverridesAndLibs): BaseContract {
protected _insertHandlers(contract: BaseContract, contractName: string, parameters: OverridesAndLibs): BaseContract {
const methodSet = new Set<string>();

for (const methodFragments of this._getContractFunctionFragments(contract.interface)) {
Expand Down Expand Up @@ -97,7 +97,7 @@ export abstract class AbstractEthersAdapter extends Adapter {
return contract;
}

public abstract overrideConnectMethod<A, I>(instance: Factory<A, I>, contractName: string): Promise<void>;
protected abstract _overrideConnectMethod<A, I>(instance: Factory<A, I>, contractName: string): Promise<void>;

private _insertAddressGetter(contract: BaseContract, contractAddress: string): void {
contract.address = contractAddress;
Expand Down
2 changes: 1 addition & 1 deletion src/deployer/adapters/BytecodeAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class BytecodeAdapter extends AbstractEthersAdapter {
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
public async overrideConnectMethod(_instance: BytecodeFactory, _contractName: string) {
protected async _overrideConnectMethod(_instance: BytecodeFactory, _contractName: string) {
return;
}
}
4 changes: 2 additions & 2 deletions src/deployer/adapters/EthersContractAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ export class EthersContractAdapter extends AbstractEthersAdapter {
}
}

public async overrideConnectMethod<A, I>(instance: EthersContract<A, I>, contractName: string) {
protected async _overrideConnectMethod<A, I>(instance: EthersContract<A, I>, contractName: string) {
const connectMethod = instance.connect;

const defaultRunner = await getSignerHelper();

instance.connect = (address: string, runner?: ContractRunner): I => {
const contract = connectMethod(address, runner ?? defaultRunner) as BaseContract;

return this.insertHandlers(contract, contractName, {}) as unknown as I;
return this._insertHandlers(contract, contractName, {}) as unknown as I;
};
}
}
4 changes: 2 additions & 2 deletions src/deployer/adapters/EthersFactoryAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ export class EthersFactoryAdapter extends AbstractEthersAdapter {
}
}

public async overrideConnectMethod(instance: ContractFactory, contractName: string) {
protected async _overrideConnectMethod(instance: ContractFactory, contractName: string) {
const attachMethod = instance.attach;

instance.attach = (target: string | Addressable): any => {
const contract = attachMethod(target);

return this.insertHandlers(contract, contractName, {});
return this._insertHandlers(contract, contractName, {});
};
}
}
7 changes: 4 additions & 3 deletions src/deployer/adapters/TruffleAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ export class TruffleAdapter extends Adapter {
);
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
public async toInstance<I>(instance: TruffleFactory<I>, address: string, _parameters: OverridesAndLibs): Promise<I> {
public async toInstance<I>(instance: TruffleFactory<I>, address: string): Promise<I> {
const contract = this._hre.artifacts.require(instance.contractName!);

await this._overrideConnectMethod(instance);

return contract.at(address);
}

Expand Down Expand Up @@ -73,7 +74,7 @@ export class TruffleAdapter extends Adapter {
}
}

public async overrideConnectMethod<I>(instance: TruffleFactory<I>) {
protected async _overrideConnectMethod<I>(instance: TruffleFactory<I>) {
const atMethod = instance.at;

instance.at = async (address: string): Promise<I> => {
Expand Down