updates to vyper as per @LianaHus more to come

pull/4626/head
Joseph Izang 9 months ago committed by Aniket
parent f135603233
commit c0154a8e4f
  1. 2
      apps/vyper/src/app/app.tsx
  2. 12
      apps/vyper/src/app/components/VyperResult.tsx
  3. 20
      apps/vyper/src/app/utils/compiler.tsx
  4. 2
      apps/vyper/src/profile.json

@ -164,7 +164,7 @@ const App = () => {
<CompilerButton compilerUrl={compilerUrl()} contract={contract} setOutput={(name, update) => setOutput({...output, [name]: update})} resetCompilerState={resetCompilerResultState} /> <CompilerButton compilerUrl={compilerUrl()} contract={contract} setOutput={(name, update) => setOutput({...output, [name]: update})} resetCompilerState={resetCompilerResultState} />
</div> </div>
<article id="result" className="p-4 mx-3 border-top mt-2"> <article id="result" className="p-2 mx-3 border-top mt-2">
{output && Object.keys(output).length > 0 && output.status !== 'failed' ? ( {output && Object.keys(output).length > 0 && output.status !== 'failed' ? (
<> <>
<VyperResult output={output} plugin={remixClient} /> <VyperResult output={output} plugin={remixClient} />

@ -67,17 +67,17 @@ function VyperResult({ output, plugin }: VyperResultProps) {
<div className="mt-1"> <div className="mt-1">
<div className="input-group input-group mt-3 d-flex flex-row-reverse"> <div className="input-group input-group mt-3 d-flex flex-row-reverse">
<div className="btn-group align-self-start" role="group" aria-label="Copy to Clipboard"> <div className="btn-group align-self-start" role="group" aria-label="Copy to Clipboard">
<CopyToClipboard tip={'Copy ABI to clipboard'} getContent={() => (Object.values(output)[0] as OutputType).abi} direction="bottom" icon="far fa-copy"> <CopyToClipboard tip={'Copy ABI to clipboard'} getContent={() => (Object.values(output)[1] as OutputType)?.abi} direction="bottom" icon="far fa-copy">
<button className="btn remixui_copyButton"> <span className="btn remixui_copyButton">
<i className="remixui_copyIcon far fa-copy" aria-hidden="true"></i> <i className="remixui_copyIcon far fa-copy" aria-hidden="true"></i>
<span>ABI</span> <span>ABI</span>
</button> </span>
</CopyToClipboard> </CopyToClipboard>
<CopyToClipboard tip={'Copy Bytecode to clipboard'} getContent={() => (Object.values(output)[0] as OutputType).bytecode.object} direction="bottom" icon="far fa-copy"> <CopyToClipboard tip={'Copy Bytecode to clipboard'} getContent={() => (Object.values(output)[1] as OutputType)?.bytecode.object} direction="bottom" icon="far fa-copy">
<button className="btn remixui_copyButton"> <span className="btn remixui_copyButton">
<i className="remixui_copyIcon far fa-copy" aria-hidden="true"></i> <i className="remixui_copyIcon far fa-copy" aria-hidden="true"></i>
<span>Bytecode</span> <span>Bytecode</span>
</button> </span>
</CopyToClipboard> </CopyToClipboard>
</div> </div>
</div> </div>

@ -141,6 +141,22 @@ const compileReturnType = (output, contract) => {
return result return result
} }
const fixContractContent = (content: string) => {
if (content.length === 0) return
const pragmaFound = content.includes('#pragma version ^0.3.10')
const evmVerFound = content.includes('#pragma evm-version shanghai')
const pragma = '#pragma version ^0.3.10'
const evmVer = '#pragma evm-version shanghai'
if (!evmVerFound) {
content = `${evmVer}\n${content}`
}
if (!pragmaFound) {
content = `${pragma}\n${content}`
}
return content
}
/** /**
* Compile the a contract * Compile the a contract
* @param url The url of the compiler * @param url The url of the compiler
@ -155,11 +171,13 @@ export async function compile(url: string, contract: Contract): Promise<any> {
throw new Error('Use extension .vy for Vyper.') throw new Error('Use extension .vy for Vyper.')
} }
let contractName = contract['name'] let contractName = contract['name']
const compilePackage = { const compilePackage = {
manifest: 'ethpm/3', manifest: 'ethpm/3',
sources: { sources: {
[contractName] : {content : contract.content} [contractName] : {content : fixContractContent(contract.content)}
} }
} }
let response = await axios.post(`${url}compile`, compilePackage ) let response = await axios.post(`${url}compile`, compilePackage )

@ -3,7 +3,7 @@
"displayName": "Vyper Compiler", "displayName": "Vyper Compiler",
"methods": ["getCompilationResult", "compile", "vyperCompileCustomAction"], "methods": ["getCompilationResult", "compile", "vyperCompileCustomAction"],
"url": "https://ipfs-cluster.ethdevops.io/ipfs/QmbmPzUg7ghTKcF2eo64zm1k1LKdibYfqYmiqXkHKXks8r", "url": "https://ipfs-cluster.ethdevops.io/ipfs/QmbmPzUg7ghTKcF2eo64zm1k1LKdibYfqYmiqXkHKXks8r",
"documentation": "https://remix-ide.readthedocs.io/en/latest/plugin_list.html", "documentation": "https://remix-ide.readthedocs.io/en/latest/vyper.html",
"description": "Compile vyper contracts", "description": "Compile vyper contracts",
"kind": "compiler", "kind": "compiler",
"icon": "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzM4IiBoZWlnaHQ9IjM3NiIgdmlld0JveD0iMCAwIDMzOCAzNzYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0xOTUuMzA0IDMxMS44MzdMODIuNTE4IDE5OS4wODRDNzcuOTI0MSAxOTQuMzA0IDc1LjM5MjcgMTg3LjgzNyA3NS4zOTI3IDE4MC42MlYxOS42OTE0Qzc1LjM5MjcgMTAuMzE4OCA2Ni4wMTc0IDAuOTQ2MTI3IDU2LjY0MiAwLjk0NjEyN0gxOS4wNDY3QzkuNjcxMjggMC45NDYxMjcgMC4yOTU4OTggMTAuMzE4OCAwLjI5NTg5OCAxOS42OTE0VjIwNy4xNDVDMC4yOTU4OTggMjE3LjA4IDMuOTUyMyAyMjYuNjQgMTAuOTgzOCAyMzMuNjY5TDE0Mi4yMzkgMzY0Ljg4NkMxNDkuNTUyIDM3Mi4xOTcgMTU5LjExNSAzNzUuODUyIDE2OC43NzIgMzc1Ljg1MkgxODcuNTIyQzE5Ny45MjkgMzc1Ljg1MiAyMDYuMjczIDM2Ny40MTcgMjA2LjI3MyAzNTcuMTA3VjMzOC40NTZDMjA2LjI3MyAzMjguODAyIDIwMi42MTcgMzE5LjI0MiAxOTUuMzA0IDMxMS45MzFWMzExLjgzN1oiIGZpbGw9IiMxODBDMjUiLz4KPHBhdGggZD0iTTMzNy44MSAxOS41OTc3QzMzNy44MSAxMC4xMzEzIDMyOC41MjkgMC44NTI0MTcgMzE5LjA1OSAwLjg1MjQxN0gyODEuNDY0QzI3Mi4wODkgMC44NTI0MTcgMjYyLj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