Skip to content

Commit

Permalink
Merge pull request #106 from rsksmart/feat/upgradeable-erc20-erc1967
Browse files Browse the repository at this point in the history
Feat/upgradeable erc20 erc1967
  • Loading branch information
Sergio authored Mar 21, 2023
2 parents e0f3dd7 + 84dd3a1 commit 7d9fe13
Show file tree
Hide file tree
Showing 5 changed files with 1,000 additions and 2,456 deletions.
13 changes: 13 additions & 0 deletions dist/services/classes/Contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ class Contract extends _BcThing.BcThing {
if (!deployedCode) throw new Error(`Missing deployed code for contract: ${this.address}`);
let info = await this.parser.getContractInfo(deployedCode, contract);
let { interfaces, methods } = info;

if (!interfaces.length) {// if no interfaces... double check
const proxyCheckResult = await this.parser.getEIP1967Info(this.address);
// if proxy detected, the implementation contract interfaces are used
if (proxyCheckResult && proxyCheckResult.interfaces.length) {
interfaces = proxyCheckResult.interfaces;
}

if (proxyCheckResult && proxyCheckResult.methods.length) {
methods = proxyCheckResult.methods;
}
};

if (interfaces.length) this.setData({ contractInterfaces: interfaces });
if (methods) this.setData({ contractMethods: methods });
}
Expand Down
Loading

0 comments on commit 7d9fe13

Please sign in to comment.