diff --git a/src/Language/Solidity/Compiler/Releases.purs b/src/Language/Solidity/Compiler/Releases.purs index e9f8c6d..a3f72b2 100644 --- a/src/Language/Solidity/Compiler/Releases.purs +++ b/src/Language/Solidity/Compiler/Releases.purs @@ -39,14 +39,14 @@ data Build = Stable (BuildR ()) | Prerelease (BuildR (prerelease :: String)) -derive instance genericBuild :: Generic Build _ -instance showBuild :: Show Build where +derive instance Generic Build _ +instance Show Build where show = genericShow -instance decodeJsonBuild :: DecodeJson Build where +instance DecodeJson Build where decodeJson j = Prerelease <$> decodeJson j <|> Stable <$> decodeJson j -instance encodeJsonBuild :: EncodeJson Build where +instance EncodeJson Build where encodeJson (Stable s) = encodeJson s encodeJson (Prerelease s) = encodeJson s @@ -57,10 +57,10 @@ newtype ReleaseList = , latestRelease :: String } -derive instance genericReleaseList :: Generic ReleaseList _ -derive newtype instance decodeJsonReleaseList :: DecodeJson ReleaseList -derive newtype instance encodeJsonReleaseList :: EncodeJson ReleaseList -instance showReleaseList :: Show ReleaseList where +derive instance Generic ReleaseList _ +derive newtype instance DecodeJson ReleaseList +derive newtype instance EncodeJson ReleaseList +instance Show ReleaseList where show = genericShow newtype ReleaseRepo = diff --git a/src/Language/Solidity/Compiler/Types/Common.purs b/src/Language/Solidity/Compiler/Types/Common.purs index 3e7d828..cb01286 100644 --- a/src/Language/Solidity/Compiler/Types/Common.purs +++ b/src/Language/Solidity/Compiler/Types/Common.purs @@ -26,14 +26,14 @@ flattenOptionalArray rs = if Array.null rs then Nothing else Just rs --- Some fields are strings which are really JSON newtype Strung a = Strung a -derive newtype instance eqStrung :: Eq a => Eq (Strung a) -derive newtype instance ordStrung :: Ord a => Ord (Strung a) -derive newtype instance semigroupStrung :: Semigroup a => Semigroup (Strung a) -derive newtype instance monoidStrung :: Monoid a => Monoid (Strung a) +derive newtype instance Eq a => Eq (Strung a) +derive newtype instance Ord a => Ord (Strung a) +derive newtype instance Semigroup a => Semigroup (Strung a) +derive newtype instance Monoid a => Monoid (Strung a) -derive instance newtypeStrung :: Newtype (Strung a) _ +derive instance Newtype (Strung a) _ -instance decodeJsonStrung :: DecodeJson a => DecodeJson (Strung a) where +instance DecodeJson a => DecodeJson (Strung a) where decodeJson j = decodeJson j >>= (lmap TypeMismatch <<< jsonParser) @@ -41,5 +41,5 @@ instance decodeJsonStrung :: DecodeJson a => DecodeJson (Strung a) where >>= pure <<< Strung -instance encodeJsonStrung :: EncodeJson a => EncodeJson (Strung a) where +instance EncodeJson a => EncodeJson (Strung a) where encodeJson (Strung a) = fromString <<< stringify $ encodeJson a diff --git a/src/Language/Solidity/Compiler/Types/Input.purs b/src/Language/Solidity/Compiler/Types/Input.purs index c14e319..a560d4a 100644 --- a/src/Language/Solidity/Compiler/Types/Input.purs +++ b/src/Language/Solidity/Compiler/Types/Input.purs @@ -22,16 +22,16 @@ import Language.Solidity.Compiler.Types.Settings (class IsSelection, CompilerSet --- "language" field of input data SourceLanguage = Solidity | Yul -derive instance eqSourceLanguage :: Eq SourceLanguage -derive instance ordSourceLanguage :: Ord SourceLanguage +derive instance Eq SourceLanguage +derive instance Ord SourceLanguage -instance decodeJsonSourceLanguage :: DecodeJson SourceLanguage where +instance DecodeJson SourceLanguage where decodeJson j = decodeJson j >>= case _ of "Solidity" -> pure Solidity "Yul" -> pure Yul x -> Left $ Named ("Unknown source language " <> x) $ UnexpectedValue j -instance encodeJsonSourceLanguage :: EncodeJson SourceLanguage where +instance EncodeJson SourceLanguage where encodeJson = A.fromString <<< case _ of Solidity -> "Solidity" Yul -> "Yul" @@ -49,10 +49,10 @@ data Source , content :: String } -derive instance eqSource :: Eq Source -derive instance ordSource :: Ord Source +derive instance Eq Source +derive instance Ord Source -instance encodeJsonSource :: EncodeJson Source where +instance EncodeJson Source where encodeJson (FromURLs u) = "urls" := u.urls ~> "keccak256" :=? u.keccak256 @@ -62,10 +62,10 @@ instance encodeJsonSource :: EncodeJson Source where newtype Sources = Sources (FO.Object Source) -derive instance newtypeSources :: Newtype Sources _ -derive newtype instance encodeJsonSources :: EncodeJson Sources -derive newtype instance eqSources :: Eq Sources -derive newtype instance ordSources :: Ord Sources +derive instance Newtype Sources _ +derive newtype instance EncodeJson Sources +derive newtype instance Eq Sources +derive newtype instance Ord Sources -------------------------------------------------- --- the input object itself @@ -76,10 +76,10 @@ newtype CompilerInput = CompilerInput , settings :: Maybe CompilerSettings } -derive instance eqCompilerInput :: Eq CompilerInput -derive instance ordCompilerInput :: Ord CompilerInput +derive instance Eq CompilerInput +derive instance Ord CompilerInput -instance encodeJsonCompilerInput :: EncodeJson CompilerInput where +instance EncodeJson CompilerInput where encodeJson (CompilerInput i) = "language" := i.language ~> "sources" := i.sources diff --git a/src/Language/Solidity/Compiler/Types/Output.purs b/src/Language/Solidity/Compiler/Types/Output.purs index 2364610..c10c775 100644 --- a/src/Language/Solidity/Compiler/Types/Output.purs +++ b/src/Language/Solidity/Compiler/Types/Output.purs @@ -91,10 +91,10 @@ instance decodeJsonErrorType :: DecodeJson ErrorType where data ErrorSeverity = SeverityError | SeverityWarning -derive instance eqErrorSeverity :: Eq ErrorSeverity -derive instance ordErrorSeverity :: Ord ErrorSeverity +derive instance Eq ErrorSeverity +derive instance Ord ErrorSeverity -instance decodeJsonErrorSeverity :: DecodeJson ErrorSeverity where +instance DecodeJson ErrorSeverity where decodeJson o = decodeJson o >>= case _ of "error" -> pure SeverityError "warning" -> pure SeverityWarning @@ -109,8 +109,8 @@ newtype SourceLocation = SourceLocation , message :: Maybe String } -derive instance eqSourceLocation :: Eq SourceLocation -derive instance ordSourceLocation :: Ord SourceLocation +derive instance Eq SourceLocation +derive instance Ord SourceLocation instance showSourceLocation :: Show SourceLocation where show (SourceLocation sl) = @@ -119,7 +119,7 @@ instance showSourceLocation :: Show SourceLocation where in sl.file <> ":" <> show sl.start <> "-" <> show sl.end <> msg -instance decodeJsonSourceLocation :: DecodeJson SourceLocation where +instance DecodeJson SourceLocation where decodeJson j = do o <- decodeJson j file <- o .: "file" @@ -143,10 +143,10 @@ data CompilationError , secondarySourceLocations :: Array SourceLocation } -derive instance eqCompilationError :: Eq CompilationError -derive instance ordCompilationError :: Ord CompilationError +derive instance Eq CompilationError +derive instance Ord CompilationError -instance decodeJsonCompilationError :: DecodeJson CompilationError where +instance DecodeJson CompilationError where decodeJson j = (SimpleCompilationError <$> decodeJson j) <|> (decodeAsObject =<< decodeJson j) where decodeAsObject o = do @@ -176,10 +176,10 @@ newtype SourceLevelOutput = SourceLevelOutput , legacyAST :: Maybe A.Json } -derive instance eqSourceLevelOutput :: Eq SourceLevelOutput -derive instance ordSourceLevelOutput :: Ord SourceLevelOutput +derive instance Eq SourceLevelOutput +derive instance Ord SourceLevelOutput -instance decodeJsonSourceLevelOutput :: DecodeJson SourceLevelOutput where +instance DecodeJson SourceLevelOutput where decodeJson j = do o <- decodeJson j id <- o .: "id" @@ -191,13 +191,13 @@ instance decodeJsonSourceLevelOutput :: DecodeJson SourceLevelOutput where --- "contracts{}{}.evm.{deployedBytecode, bytecode}.object" field of output data BytecodeObject = BytecodeHexString HexString | BytecodeUnlinked String -derive instance eqBytecodeObject :: Eq BytecodeObject -derive instance ordBytecodeObject :: Ord BytecodeObject +derive instance Eq BytecodeObject +derive instance Ord BytecodeObject -instance decodeJsonBytecodeObject :: DecodeJson BytecodeObject where +instance DecodeJson BytecodeObject where decodeJson = map mkBytecodeObject <<< decodeJson -instance encodeJsonBytecodeObject :: EncodeJson BytecodeObject where +instance EncodeJson BytecodeObject where encodeJson = encodeJson <<< unBytecodeObject mkBytecodeObject :: String -> BytecodeObject @@ -215,17 +215,17 @@ data LinkReference = LinkReference , length :: Int } -derive instance eqLinkReference :: Eq LinkReference -derive instance ordLinkReference :: Ord LinkReference +derive instance Eq LinkReference +derive instance Ord LinkReference -instance decodeJsonLinkReference :: DecodeJson LinkReference where +instance DecodeJson LinkReference where decodeJson j = do o <- decodeJson j start <- o .: "start" length <- o .: "length" pure $ LinkReference { start, length } -instance encodeJsonLinkReference :: EncodeJson LinkReference where +instance EncodeJson LinkReference where encodeJson (LinkReference { start, length }) = "start" := start ~> "length" := length @@ -233,10 +233,10 @@ instance encodeJsonLinkReference :: EncodeJson LinkReference where newtype LinkReferences = LinkReferences (FileMapped (ContractMapped (Array LinkReference))) -derive instance newtypeLinkReferences :: Newtype LinkReferences _ -derive newtype instance eqLinkReferences :: Eq LinkReferences -derive newtype instance ordLinkReferences :: Ord LinkReferences -derive newtype instance decodeJsonLinkReferences :: DecodeJson LinkReferences +derive instance Newtype LinkReferences _ +derive newtype instance Eq LinkReferences +derive newtype instance Ord LinkReferences +derive newtype instance DecodeJson LinkReferences -------------------------------------------------- --- "contracts{}{}.evm.{deployedBytecode, bytecode}" field of output @@ -247,10 +247,10 @@ newtype BytecodeOutput = BytecodeOutput , linkReferences :: Maybe LinkReferences } -derive instance eqBytecodeOutput :: Eq BytecodeOutput -derive instance ordBytecodeOutput :: Ord BytecodeOutput +derive instance Eq BytecodeOutput +derive instance Ord BytecodeOutput -instance decodeJsonBytecodeOutput :: DecodeJson BytecodeOutput where +instance DecodeJson BytecodeOutput where decodeJson j = do o <- decodeJson j object <- o .:? "object" @@ -263,29 +263,29 @@ instance decodeJsonBytecodeOutput :: DecodeJson BytecodeOutput where --- "contracts{}{}.evm.methodIdentifiers" field of output newtype MethodIdentifiers = MethodIdentifiers (FO.Object HexString) -derive instance newtypeMethodIdentifiers :: Newtype MethodIdentifiers _ -derive newtype instance eqMethodIdentifiers :: Eq MethodIdentifiers -derive newtype instance ordMethodIdentifiers :: Ord MethodIdentifiers -derive newtype instance decodeJsonMethodIdentifiers :: DecodeJson MethodIdentifiers +derive instance Newtype MethodIdentifiers _ +derive newtype instance Eq MethodIdentifiers +derive newtype instance Ord MethodIdentifiers +derive newtype instance DecodeJson MethodIdentifiers -------------------------------------------------- --- "contracts{}{}.evm.gasEstimates.*" values of output data GasEstimate = InfiniteGas | GasCount BigNumber -derive instance eqGasEstimate :: Eq GasEstimate -derive instance ordGasEstimate :: Ord GasEstimate +derive instance Eq GasEstimate +derive instance Ord GasEstimate -instance decodeJsonGasEstimate :: DecodeJson GasEstimate where +instance DecodeJson GasEstimate where decodeJson j = decodeJson j >>= case _ of "infinite" -> pure InfiniteGas x -> note (Named "invalid BigNumber" $ UnexpectedValue j) $ GasCount <$> fromStringAs Int.decimal x newtype GasEstimates = GasEstimates (FO.Object GasEstimate) -derive newtype instance eqGasEstimates :: Eq GasEstimates -derive newtype instance ordGasEstimates :: Ord GasEstimates -derive newtype instance decodeJsonGasEstimates :: DecodeJson GasEstimates +derive newtype instance Eq GasEstimates +derive newtype instance Ord GasEstimates +derive newtype instance DecodeJson GasEstimates newtype CreationGasEstimates = CreationGasEstimates { codeDepositCost :: Maybe GasEstimate @@ -293,10 +293,10 @@ newtype CreationGasEstimates = CreationGasEstimates , totalCost :: Maybe GasEstimate } -derive instance eqCreationGasEstimates :: Eq CreationGasEstimates -derive instance ordCreationGasEstimates :: Ord CreationGasEstimates +derive instance Eq CreationGasEstimates +derive instance Ord CreationGasEstimates -instance decodeJsonCreationGasEstimates :: DecodeJson CreationGasEstimates where +instance DecodeJson CreationGasEstimates where decodeJson j = do o <- decodeJson j codeDepositCost <- o .:? "codeDepositCost" @@ -312,10 +312,10 @@ newtype ContractGasEstimates = ContractGasEstimates , internal :: Maybe (FO.Object GasEstimate) } -derive instance eqContractGasEstimates :: Eq ContractGasEstimates -derive instance ordContractGasEstimates :: Ord ContractGasEstimates +derive instance Eq ContractGasEstimates +derive instance Ord ContractGasEstimates -instance decodeJsonContractGasEstimates :: DecodeJson ContractGasEstimates where +instance DecodeJson ContractGasEstimates where decodeJson j = do o <- decodeJson j creation <- o .:? "creation" @@ -335,10 +335,10 @@ newtype EvmOutput = EvmOutput , gasEstimates :: Maybe GasEstimates } -derive instance eqEvmOutput :: Eq EvmOutput -derive instance ordEvmOutput :: Ord EvmOutput +derive instance Eq EvmOutput +derive instance Ord EvmOutput -instance decodeJsonEvmOutput :: DecodeJson EvmOutput where +instance DecodeJson EvmOutput where decodeJson j = do o <- decodeJson j assembly <- o .:? "assembly" @@ -363,10 +363,10 @@ newtype EwasmOutput = EwasmOutput , wasm :: Maybe HexString } -derive instance eqEwasmOutput :: Eq EwasmOutput -derive instance ordEwasmOutput :: Ord EwasmOutput +derive instance Eq EwasmOutput +derive instance Ord EwasmOutput -instance decodeJsonEwasmOutput :: DecodeJson EwasmOutput where +instance DecodeJson EwasmOutput where decodeJson j = do o <- decodeJson j wast <- o .:? "wast" @@ -386,10 +386,10 @@ newtype ContractLevelOutput = ContractLevelOutput , ewasm :: Maybe EwasmOutput } -derive instance eqContractLevelOutput :: Eq ContractLevelOutput -derive instance ordContractLevelOutput :: Ord ContractLevelOutput +derive instance Eq ContractLevelOutput +derive instance Ord ContractLevelOutput -instance decodeJsonContractLevelOutput :: DecodeJson ContractLevelOutput where +instance DecodeJson ContractLevelOutput where decodeJson j = do o <- decodeJson j abi <- o .:? "abi" @@ -409,10 +409,10 @@ newtype CompilerOutput = CompilerOutput , contracts :: FileMapped (ContractMapped ContractLevelOutput) } -derive instance eqCompilerOutput :: Eq CompilerOutput -derive instance ordCompilerOutput :: Ord CompilerOutput +derive instance Eq CompilerOutput +derive instance Ord CompilerOutput -instance decodeJsonCompilerOutput :: DecodeJson CompilerOutput where +instance DecodeJson CompilerOutput where decodeJson j = do o <- decodeJson j errors <- o .:? "errors" .!= [] diff --git a/src/Language/Solidity/Compiler/Types/Settings.purs b/src/Language/Solidity/Compiler/Types/Settings.purs index 1b5b703..9a2a72f 100644 --- a/src/Language/Solidity/Compiler/Types/Settings.purs +++ b/src/Language/Solidity/Compiler/Types/Settings.purs @@ -62,16 +62,16 @@ newtype YulOptimizerDetails = YulOptimizerDetails { stackAllocation :: Boolean } -derive instance eqYulOptimizerDetails :: Eq YulOptimizerDetails -derive instance ordYulOptimizerDetails :: Ord YulOptimizerDetails +derive instance Eq YulOptimizerDetails +derive instance Ord YulOptimizerDetails -instance decodeJsonYulOptimizerDetails :: DecodeJson YulOptimizerDetails where +instance DecodeJson YulOptimizerDetails where decodeJson j = do o <- decodeJson j stackAllocation <- o .: "stackAllocation" pure $ YulOptimizerDetails { stackAllocation } -instance encodeJsonYulOptimizerDetails :: EncodeJson YulOptimizerDetails where +instance EncodeJson YulOptimizerDetails where encodeJson (YulOptimizerDetails y) = jsonSingletonObject "stackAllocation" (A.fromBoolean y.stackAllocation) @@ -89,10 +89,10 @@ newtype OptimizerDetails = OptimizerDetails , yulDetails :: Maybe YulOptimizerDetails } -derive instance eqOptimizerDetails :: Eq OptimizerDetails -derive instance ordOptimizerDetails :: Ord OptimizerDetails +derive instance Eq OptimizerDetails +derive instance Ord OptimizerDetails -instance decodeJsonOptimizerDetails :: DecodeJson OptimizerDetails where +instance DecodeJson OptimizerDetails where decodeJson j = do o <- decodeJson j peephole <- o .:! "peephole" @@ -114,7 +114,7 @@ instance decodeJsonOptimizerDetails :: DecodeJson OptimizerDetails where , yulDetails } -instance encodeJsonOptimizerDetails :: EncodeJson OptimizerDetails where +instance EncodeJson OptimizerDetails where encodeJson (OptimizerDetails o) = "peephole" :=? o.peephole ~>? "jumpdestRemove" :=? o.jumpdestRemove @@ -138,7 +138,7 @@ newtype OptimizerSettings = OptimizerSettings derive instance eqOptimizerSettings :: Eq OptimizerSettings derive instance ordOptimizerSettings :: Ord OptimizerSettings -instance decodeJsonOptimizerSettings :: DecodeJson OptimizerSettings where +instance DecodeJson OptimizerSettings where decodeJson j = do o <- decodeJson j enabled <- o .:! "enabled" @@ -146,7 +146,7 @@ instance decodeJsonOptimizerSettings :: DecodeJson OptimizerSettings where details <- o .:! "details" pure $ OptimizerSettings { enabled, runs, details } -instance encodeJsonOptimizerSettings :: EncodeJson OptimizerSettings where +instance EncodeJson OptimizerSettings where encodeJson (OptimizerSettings o) = "enabled" :=? o.enabled ~>? "runs" :=? o.runs @@ -154,8 +154,8 @@ instance encodeJsonOptimizerSettings :: EncodeJson OptimizerSettings where ~>? jsonEmptyObject -------------------------------------------------- ---- "settings.evmVersion" - +--- "settings.evmVersion", e.g. see +-- https://docs.soliditylang.org/en/v0.8.20/using-the-compiler.html#target-options data EvmVersion = Homestead -- at 1150000 | TangerineWhistle -- aka EIP-150, at 2463000 @@ -163,11 +163,15 @@ data EvmVersion | Byzantium -- aka EIP-609, at 4370000 | Constantinople -- aka EIP-1013, at 7280000 | Petersburg -- aka EIP-1014, at 7280000 + | Istanbul + | Berlin + | London + | Paris -derive instance eqEvmVersion :: Eq EvmVersion -derive instance ordEvmVersion :: Ord EvmVersion +derive instance Eq EvmVersion +derive instance Ord EvmVersion -instance decodeJsonEvmVersion :: DecodeJson EvmVersion where +instance DecodeJson EvmVersion where decodeJson j = decodeJson j >>= case _ of "homestead" -> pure Homestead "tangerineWhistle" -> pure TangerineWhistle @@ -175,9 +179,13 @@ instance decodeJsonEvmVersion :: DecodeJson EvmVersion where "byzantium" -> pure Byzantium "constantinople" -> pure Constantinople "petersburg" -> pure Petersburg + "istanbul" -> pure Istanbul + "berlin" -> pure Berlin + "london" -> pure London + "paris" -> pure Paris x -> Left $ Named ("Unknown EVM version " <> x) $ UnexpectedValue j -instance encodeJsonEvmVersion :: EncodeJson EvmVersion where +instance EncodeJson EvmVersion where encodeJson = A.fromString <<< case _ of Homestead -> "homestead" TangerineWhistle -> "tangerineWhistle" @@ -185,6 +193,10 @@ instance encodeJsonEvmVersion :: EncodeJson EvmVersion where Byzantium -> "byzantium" Constantinople -> "constantinople" Petersburg -> "petersburg" + Istanbul -> "istanbul" + Berlin -> "berlin" + London -> "london" + Paris -> "paris" -------------------------------------------------- --- "settings.metadata" @@ -193,16 +205,16 @@ newtype MetadataSettings = MetadataSettings { useLiteralContent :: Boolean } -derive instance eqMetadataSettings :: Eq MetadataSettings -derive instance ordMetadataSettings :: Ord MetadataSettings +derive instance Eq MetadataSettings +derive instance Ord MetadataSettings -instance decodeJsonMetadataSettings :: DecodeJson MetadataSettings where +instance DecodeJson MetadataSettings where decodeJson j = do o <- decodeJson j useLiteralContent <- o .:! "useLiteralContent" .!= false pure $ MetadataSettings { useLiteralContent } -instance encodeJsonMetadataSettings :: EncodeJson MetadataSettings where +instance EncodeJson MetadataSettings where encodeJson (MetadataSettings ms) = jsonSingletonObject "useLiteralContent" $ A.fromBoolean ms.useLiteralContent @@ -223,9 +235,9 @@ instance encodeJsonLibrary :: EncodeJson Library where newtype Libraries = Libraries (FileMapped Library) -derive newtype instance eqLibraries :: Eq Libraries -derive newtype instance ordLibraries :: Ord Libraries -derive newtype instance encodeJsonLibraries :: EncodeJson Libraries +derive newtype instance Eq Libraries +derive newtype instance Ord Libraries +derive newtype instance EncodeJson Libraries -------------------------------------------------- --- "settings.outputSelection" @@ -252,7 +264,7 @@ mapFromSelectionNullable :: forall a b. IsSelection a => (Maybe a -> b) -> Array mapFromSelectionNullable f [] = Just (f Nothing) mapFromSelectionNullable f xs = (f <<< Just) <$> fromSelection xs -instance isSelectionMaybe :: IsSelection a => IsSelection (Maybe a) where +instance IsSelection a => IsSelection (Maybe a) where toSelection Nothing = [] toSelection (Just a) = toSelection a @@ -263,10 +275,10 @@ data FileLevelSelection = AST | LegacyAST -derive instance eqFileLevelSelection :: Eq FileLevelSelection -derive instance ordFileLevelSelection :: Ord FileLevelSelection +derive instance Eq FileLevelSelection +derive instance Ord FileLevelSelection -instance isSelectionFileLevel :: IsSelection FileLevelSelection where +instance IsSelection FileLevelSelection where toSelection AST = [ "ast" ] toSelection LegacyAST = [ "legacyAST" ] @@ -280,10 +292,10 @@ data EvmBytecodeOutput | BytecodeSourceMap | BytecodeLinkReferences -derive instance eqEvmBytecodeOutput :: Eq EvmBytecodeOutput -derive instance ordEvmBytecodeOutput :: Ord EvmBytecodeOutput +derive instance Eq EvmBytecodeOutput +derive instance Ord EvmBytecodeOutput -instance isSelectionBytecode :: IsSelection EvmBytecodeOutput where +instance IsSelection EvmBytecodeOutput where toSelection BytecodeObject = [ "object" ] toSelection BytecodeOpcodes = [ "opcodes" ] toSelection BytecodeSourceMap = [ "sourceMap" ] @@ -303,10 +315,10 @@ data EvmOutputSelection | MethodIdentifiersSelection | GasEstimatesSelection -derive instance eqEvmOutputSelection :: Eq EvmOutputSelection -derive instance ordEvmOutputSelection :: Ord EvmOutputSelection +derive instance Eq EvmOutputSelection +derive instance Ord EvmOutputSelection -instance isSelectionEvmOutput :: IsSelection EvmOutputSelection where +instance IsSelection EvmOutputSelection where toSelection = case _ of AssemblySelection -> [ "assembly" ] LegacyAssemblySelection -> [ "legacyAssembly" ] @@ -328,10 +340,10 @@ data EwasmOutputSelection = Wast | Wasm -derive instance eqEwasmOutputSelection :: Eq EwasmOutputSelection -derive instance ordEwasmOutputSelection :: Ord EwasmOutputSelection +derive instance Eq EwasmOutputSelection +derive instance Ord EwasmOutputSelection -instance isSelectionEwasmOutput :: IsSelection EwasmOutputSelection where +instance IsSelection EwasmOutputSelection where toSelection = case _ of Wast -> [ "wast" ] Wasm -> [ "wasm" ] @@ -350,10 +362,10 @@ data ContractLevelSelection | EvmOutputSelection (Maybe EvmOutputSelection) | EwasmOutputSelection (Maybe EwasmOutputSelection) -derive instance eqContractLevelSelection :: Eq ContractLevelSelection -derive instance ordContractLevelSelection :: Ord ContractLevelSelection +derive instance Eq ContractLevelSelection +derive instance Ord ContractLevelSelection -instance isSelectionContractLevel :: IsSelection ContractLevelSelection where +instance IsSelection ContractLevelSelection where toSelection ABI = [ "abi" ] toSelection DevDoc = [ "devdoc" ] toSelection UserDoc = [ "userdoc" ] @@ -379,10 +391,10 @@ newtype OutputSelection = OutputSelection , contract :: ContractMapped (Array ContractLevelSelection) } -derive instance eqOutputSelection :: Eq OutputSelection -derive instance ordOutputSelection :: Ord OutputSelection +derive instance Eq OutputSelection +derive instance Ord OutputSelection -instance decodeJsonOutputSelection :: DecodeJson OutputSelection where +instance DecodeJson OutputSelection where decodeJson j = do (o :: FO.Object Json) <- decodeJson j let Tuple fileJ contractJ = fromMaybe (Tuple jsonEmptyArray o) $ FO.pop "" o @@ -390,7 +402,7 @@ instance decodeJsonOutputSelection :: DecodeJson OutputSelection where contract <- for contractJ $ (traverse decodeJsonSelection' <=< decodeJson) pure $ OutputSelection { file, contract } -instance encodeJsonOutputSelection :: EncodeJson OutputSelection where +instance EncodeJson OutputSelection where encodeJson (OutputSelection { file, contract }) = let fileLevelJson = nub $ encodeJsonSelection <$> file @@ -402,9 +414,9 @@ instance encodeJsonOutputSelection :: EncodeJson OutputSelection where newtype OutputSelections = OutputSelections (FileMapped OutputSelection) -derive newtype instance encodeJsonOutputSelections :: EncodeJson OutputSelections -derive newtype instance eqOutputSelections :: Eq OutputSelections -derive newtype instance ordOutputSelections :: Ord OutputSelections +derive newtype instance EncodeJson OutputSelections +derive newtype instance Eq OutputSelections +derive newtype instance Ord OutputSelections -------------------------------------------------- --- "settings" @@ -418,10 +430,10 @@ newtype CompilerSettings = CompilerSettings , outputSelection :: Maybe OutputSelections } -derive instance eqCompilerSettings :: Eq CompilerSettings -derive instance ordCompilerSettings :: Ord CompilerSettings +derive instance Eq CompilerSettings +derive instance Ord CompilerSettings -instance encodeJsonCompilerSettings :: EncodeJson CompilerSettings where +instance EncodeJson CompilerSettings where encodeJson (CompilerSettings s) = "remappings" :=? (flattenOptionalArray s.remappings) ~>? "optimizer" :=? s.optimizer