-
-
Save chriseth/8f533d133fa0c15b0d6eaf3ec502c82b to your computer and use it in GitHub Desktop.
ABI to solidity interface converter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// Credits: @rangelife | |
var fs=require('fs'); | |
try { | |
var abi=JSON.parse(fs.readFileSync(process.argv[3])); | |
} catch (e) { | |
dieUsage(); | |
} | |
var contractName=process.argv[2]; | |
if(!contractName) dieUsage(); | |
var toDump=""; | |
function dump(x) { | |
toDump += x; | |
} | |
dump("contract "+contractName); | |
dump("{"); | |
var i=0; | |
for(i=0;i<abi.length;i++) { | |
var entity=abi[i]; | |
if (!Array.isArray(entity.inputs)) { | |
die("entity inputs isn't an array in "+JSON.stringify(entity)); | |
} | |
switch (entity.type) { | |
case 'constructor': | |
dumpConstructor(entity); | |
break; | |
case 'function': | |
dumpFunction(entity); | |
break; | |
case 'event': | |
// these don't go in the interface file | |
break; | |
default: | |
die("Unknown entity type "+entity.type+" in ABI."); | |
} | |
} | |
dump("}"); | |
console.log(toDump); | |
/////////// | |
function die(x) { | |
console.error(x); | |
process.exit(1); | |
} | |
function dieUsage() { | |
die("Usage: "+process.argv[1]+" [contractName] [ABI file]"); | |
} | |
function dumpConstructor(entity) { | |
dump("function "+contractName+"("); | |
dumpArgs(entity.inputs); | |
dump(");"); | |
} | |
function dumpFunction(entity) { | |
dump("function "+entity.name+"("); | |
dumpArgs(entity.inputs); | |
dump(") "); | |
if (entity.constant) { | |
dump("constant "); | |
} | |
if (entity.outputs.length) { | |
dump("returns ("); | |
dumpArgs(entity.outputs); | |
dump(")") | |
} | |
dump(";"); | |
} | |
function dumpArgs(args) { | |
var i; | |
for (i=0;i<args.length;i++) { | |
var arg = args[i]; | |
if(i) dump(","); | |
dump(arg.type+" "+arg.name); | |
} | |
} |
Hi can you assist me?
You know I can assistance because I have the access of this contract, I can provide you the CoinMarketCap information and ethereum information to get all your access
Sry I just saw this. How do you mean?
…On Fri, Sep 23, 2022 at 1:52 AM Marykassman ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
You know I can assistance because I have the access of this contract, I
can provide you the CoinMarketCap information and ethereum information to
get all your access
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/8f533d133fa0c15b0d6eaf3ec502c82b#gistcomment-4312771>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIVSNK4XT3O6APUFATLKJILV7VOVNANCNFSM4234LWUQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
Marykassman can you help me gain access to this contract 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2. I've already got verified I on etherscan and was able to move and somewhat interact with tokens. Just no withdrawl. Yet.......
Remind me what we were speaking about. Sry I don’t recall.
…On Tue, Nov 21, 2023 at 2:03 AM Shuebird-svg ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Marykassman can you help me gain access to this contract
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2. I've already got verified I on
etherscan and was able to move and somewhat interact with tokens. Just no
withdrawl. Yet.......
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/chriseth/8f533d133fa0c15b0d6eaf3ec502c82b#gistcomment-4767476>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIVSNKYMAI3K7YJKN32ERIDYFRU7JBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVAZTSOBXG4YTKNVHORZGSZ3HMVZKMY3SMVQXIZI>
.
You are receiving this email because you commented on the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello