From 80784b6fc3c7cc5256b98601a0451859920f219b Mon Sep 17 00:00:00 2001 From: Zach Kolodny Date: Wed, 21 Apr 2021 17:59:17 -0400 Subject: [PATCH] Added in chainlink ETH/USD pair contract --- contracts/abis/ChainlinkEACAggregator.json | 509 ++++++++++++++++++ .../Contracts/ChainlinkEACAggregator.hs | 12 + pixura-contracts.cabal | 3 +- .../src/Contracts/ChainlinkEACAggregator.purs | 389 +++++++++++++ stack.yaml | 4 +- stack.yaml.lock | 10 +- yarn.lock | 56 +- 7 files changed, 947 insertions(+), 36 deletions(-) create mode 100644 contracts/abis/ChainlinkEACAggregator.json create mode 100644 hs-contracts/src/Pixura/Contracts/ChainlinkEACAggregator.hs create mode 100644 purs-contracts/src/Contracts/ChainlinkEACAggregator.purs diff --git a/contracts/abis/ChainlinkEACAggregator.json b/contracts/abis/ChainlinkEACAggregator.json new file mode 100644 index 0000000..62cc01b --- /dev/null +++ b/contracts/abis/ChainlinkEACAggregator.json @@ -0,0 +1,509 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_aggregator", + "type": "address" + }, + { + "internalType": "address", + "name": "_accessController", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "int256", + "name": "current", + "type": "int256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "roundId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "updatedAt", + "type": "uint256" + } + ], + "name": "AnswerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "roundId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "startedBy", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "startedAt", + "type": "uint256" + } + ], + "name": "NewRound", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "OwnershipTransferRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "accessController", + "outputs": [ + { + "internalType": "contract AccessControllerInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "aggregator", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_aggregator", + "type": "address" + } + ], + "name": "confirmAggregator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "description", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_roundId", + "type": "uint256" + } + ], + "name": "getAnswer", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint80", + "name": "_roundId", + "type": "uint80" + } + ], + "name": "getRoundData", + "outputs": [ + { + "internalType": "uint80", + "name": "roundId", + "type": "uint80" + }, + { + "internalType": "int256", + "name": "answer", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "startedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAt", + "type": "uint256" + }, + { + "internalType": "uint80", + "name": "answeredInRound", + "type": "uint80" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_roundId", + "type": "uint256" + } + ], + "name": "getTimestamp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "latestAnswer", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "latestRound", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "latestRoundData", + "outputs": [ + { + "internalType": "uint80", + "name": "roundId", + "type": "uint80" + }, + { + "internalType": "int256", + "name": "answer", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "startedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAt", + "type": "uint256" + }, + { + "internalType": "uint80", + "name": "answeredInRound", + "type": "uint80" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "latestTimestamp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "phaseAggregators", + "outputs": [ + { + "internalType": "contract AggregatorV2V3Interface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "phaseId", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_aggregator", + "type": "address" + } + ], + "name": "proposeAggregator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "proposedAggregator", + "outputs": [ + { + "internalType": "contract AggregatorV2V3Interface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint80", + "name": "_roundId", + "type": "uint80" + } + ], + "name": "proposedGetRoundData", + "outputs": [ + { + "internalType": "uint80", + "name": "roundId", + "type": "uint80" + }, + { + "internalType": "int256", + "name": "answer", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "startedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAt", + "type": "uint256" + }, + { + "internalType": "uint80", + "name": "answeredInRound", + "type": "uint80" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proposedLatestRoundData", + "outputs": [ + { + "internalType": "uint80", + "name": "roundId", + "type": "uint80" + }, + { + "internalType": "int256", + "name": "answer", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "startedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAt", + "type": "uint256" + }, + { + "internalType": "uint80", + "name": "answeredInRound", + "type": "uint80" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_accessController", + "type": "address" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/hs-contracts/src/Pixura/Contracts/ChainlinkEACAggregator.hs b/hs-contracts/src/Pixura/Contracts/ChainlinkEACAggregator.hs new file mode 100644 index 0000000..e060c26 --- /dev/null +++ b/hs-contracts/src/Pixura/Contracts/ChainlinkEACAggregator.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE QuasiQuotes #-} + +module Pixura.Contracts.ChainlinkEACAggregator where + +import Network.Ethereum.Contract.TH + +[abiFrom|contracts/abis/ChainlinkEACAggregator.json|] \ No newline at end of file diff --git a/pixura-contracts.cabal b/pixura-contracts.cabal index 1287fe4..8d09f49 100644 --- a/pixura-contracts.cabal +++ b/pixura-contracts.cabal @@ -4,7 +4,7 @@ cabal-version: 1.12 -- -- see: https://github.com/sol/hpack -- --- hash: 5e0d197eb8f9e82f332427a1c2b10111c775d5280b190aa426f365efe25736ef +-- hash: 6325ba26c39c9ef0a898ef25a4e83fb43ac9861f44bb83bbdbae638876d89953 name: pixura-contracts version: 0.3.0.0 @@ -28,6 +28,7 @@ source-repository head library exposed-modules: Pixura.Contracts.Autoglyphs + Pixura.Contracts.ChainlinkEACAggregator Pixura.Contracts.CryptoPunks Pixura.Contracts.ERC20 Pixura.Contracts.ERC721 diff --git a/purs-contracts/src/Contracts/ChainlinkEACAggregator.purs b/purs-contracts/src/Contracts/ChainlinkEACAggregator.purs new file mode 100644 index 0000000..b31e0a2 --- /dev/null +++ b/purs-contracts/src/Contracts/ChainlinkEACAggregator.purs @@ -0,0 +1,389 @@ +-------------------------------------------------------------------------------- +-- | ChainlinkEACAggregator +-------------------------------------------------------------------------------- + +module Contracts.ChainlinkEACAggregator where + +import Prelude + +import Data.Either (Either) +import Data.Functor.Tagged (Tagged, tagged) +import Data.Generic.Rep (class Generic) +import Data.Generic.Rep.Eq (genericEq) +import Data.Generic.Rep.Show (genericShow) +import Data.Lens ((.~)) +import Data.Maybe (Maybe(..), fromJust) +import Data.Newtype (class Newtype) +import Data.Symbol (SProxy) +import Network.Ethereum.Web3 (_address, _topics, call, class EventFilter, deployContract, sendTx) +import Network.Ethereum.Web3.Contract.Internal (uncurryFields) +import Network.Ethereum.Web3.Solidity (D0, D1, D2, D5, D6, D8, DOne, IntN, Tuple0(..), Tuple1(..), Tuple2(..), Tuple5, UIntN, class IndexedEvent, unTuple1) +import Network.Ethereum.Web3.Solidity.Size (type (:&)) +import Network.Ethereum.Web3.Types (Address, CallError, ChainCursor, HexString, NoPay, TransactionOptions, Web3, defaultFilter, mkHexString) +import Partial.Unsafe (unsafePartial) +-------------------------------------------------------------------------------- +-- | ConstructorFn +-------------------------------------------------------------------------------- + + +type ConstructorFn = Tagged (SProxy "constructor(address,address)") (Tuple2 (Tagged (SProxy "_aggregator") Address) (Tagged (SProxy "_accessController") Address)) + +constructor :: TransactionOptions NoPay -> HexString -> { _aggregator :: Address, _accessController :: Address } -> Web3 HexString +constructor x0 bc r = uncurryFields r $ constructor' x0 bc + where + constructor' :: TransactionOptions NoPay -> HexString -> (Tagged (SProxy "_aggregator") Address) -> (Tagged (SProxy "_accessController") Address) -> Web3 HexString + constructor' y0 bc' y2 y3 = deployContract y0 bc' ((tagged $ Tuple2 y2 y3) :: ConstructorFn) + +-------------------------------------------------------------------------------- +-- | AnswerUpdated +-------------------------------------------------------------------------------- + + +newtype AnswerUpdated = AnswerUpdated {current :: (IntN (D2 :& D5 :& DOne D6)),roundId :: (UIntN (D2 :& D5 :& DOne D6)),updatedAt :: (UIntN (D2 :& D5 :& DOne D6))} + +derive instance newtypeAnswerUpdated :: Newtype AnswerUpdated _ + +instance eventFilterAnswerUpdated :: EventFilter AnswerUpdated where + eventFilter _ addr = defaultFilter + # _address .~ Just addr + # _topics .~ Just [Just ( unsafePartial $ fromJust $ mkHexString "0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f"),Nothing,Nothing] + +instance indexedEventAnswerUpdated :: IndexedEvent (Tuple2 (Tagged (SProxy "current") (IntN (D2 :& D5 :& DOne D6))) (Tagged (SProxy "roundId") (UIntN (D2 :& D5 :& DOne D6)))) (Tuple1 (Tagged (SProxy "updatedAt") (UIntN (D2 :& D5 :& DOne D6)))) AnswerUpdated where + isAnonymous _ = false + +derive instance genericAnswerUpdated :: Generic AnswerUpdated _ + +instance eventGenericAnswerUpdatedShow :: Show AnswerUpdated where + show = genericShow + +instance eventGenericAnswerUpdatedeq :: Eq AnswerUpdated where + eq = genericEq + +-------------------------------------------------------------------------------- +-- | NewRound +-------------------------------------------------------------------------------- + + +newtype NewRound = NewRound {roundId :: (UIntN (D2 :& D5 :& DOne D6)),startedBy :: Address,startedAt :: (UIntN (D2 :& D5 :& DOne D6))} + +derive instance newtypeNewRound :: Newtype NewRound _ + +instance eventFilterNewRound :: EventFilter NewRound where + eventFilter _ addr = defaultFilter + # _address .~ Just addr + # _topics .~ Just [Just ( unsafePartial $ fromJust $ mkHexString "0109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac60271"),Nothing,Nothing] + +instance indexedEventNewRound :: IndexedEvent (Tuple2 (Tagged (SProxy "roundId") (UIntN (D2 :& D5 :& DOne D6))) (Tagged (SProxy "startedBy") Address)) (Tuple1 (Tagged (SProxy "startedAt") (UIntN (D2 :& D5 :& DOne D6)))) NewRound where + isAnonymous _ = false + +derive instance genericNewRound :: Generic NewRound _ + +instance eventGenericNewRoundShow :: Show NewRound where + show = genericShow + +instance eventGenericNewRoundeq :: Eq NewRound where + eq = genericEq + +-------------------------------------------------------------------------------- +-- | OwnershipTransferRequested +-------------------------------------------------------------------------------- + + +newtype OwnershipTransferRequested = OwnershipTransferRequested {from :: Address,to :: Address} + +derive instance newtypeOwnershipTransferRequested :: Newtype OwnershipTransferRequested _ + +instance eventFilterOwnershipTransferRequested :: EventFilter OwnershipTransferRequested where + eventFilter _ addr = defaultFilter + # _address .~ Just addr + # _topics .~ Just [Just ( unsafePartial $ fromJust $ mkHexString "ed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278"),Nothing,Nothing] + +instance indexedEventOwnershipTransferRequested :: IndexedEvent (Tuple2 (Tagged (SProxy "from") Address) (Tagged (SProxy "to") Address)) (Tuple0 ) OwnershipTransferRequested where + isAnonymous _ = false + +derive instance genericOwnershipTransferRequested :: Generic OwnershipTransferRequested _ + +instance eventGenericOwnershipTransferRequestedShow :: Show OwnershipTransferRequested where + show = genericShow + +instance eventGenericOwnershipTransferRequestedeq :: Eq OwnershipTransferRequested where + eq = genericEq + +-------------------------------------------------------------------------------- +-- | OwnershipTransferred +-------------------------------------------------------------------------------- + + +newtype OwnershipTransferred = OwnershipTransferred {from :: Address,to :: Address} + +derive instance newtypeOwnershipTransferred :: Newtype OwnershipTransferred _ + +instance eventFilterOwnershipTransferred :: EventFilter OwnershipTransferred where + eventFilter _ addr = defaultFilter + # _address .~ Just addr + # _topics .~ Just [Just ( unsafePartial $ fromJust $ mkHexString "8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0"),Nothing,Nothing] + +instance indexedEventOwnershipTransferred :: IndexedEvent (Tuple2 (Tagged (SProxy "from") Address) (Tagged (SProxy "to") Address)) (Tuple0 ) OwnershipTransferred where + isAnonymous _ = false + +derive instance genericOwnershipTransferred :: Generic OwnershipTransferred _ + +instance eventGenericOwnershipTransferredShow :: Show OwnershipTransferred where + show = genericShow + +instance eventGenericOwnershipTransferredeq :: Eq OwnershipTransferred where + eq = genericEq + +-------------------------------------------------------------------------------- +-- | AcceptOwnershipFn +-------------------------------------------------------------------------------- + + +type AcceptOwnershipFn = Tagged (SProxy "acceptOwnership()") (Tuple0 ) + +acceptOwnership :: TransactionOptions NoPay -> Web3 HexString +acceptOwnership x0 = sendTx x0 ((tagged $ Tuple0 ) :: AcceptOwnershipFn) + +-------------------------------------------------------------------------------- +-- | AccessControllerFn +-------------------------------------------------------------------------------- + + +type AccessControllerFn = Tagged (SProxy "accessController()") (Tuple0 ) + +accessController :: TransactionOptions NoPay -> ChainCursor -> Web3 (Either CallError Address) +accessController x0 cm = map unTuple1 <$> call x0 cm ((tagged $ Tuple0 ) :: AccessControllerFn) + +-------------------------------------------------------------------------------- +-- | AggregatorFn +-------------------------------------------------------------------------------- + + +type AggregatorFn = Tagged (SProxy "aggregator()") (Tuple0 ) + +aggregator :: TransactionOptions NoPay -> ChainCursor -> Web3 (Either CallError Address) +aggregator x0 cm = map unTuple1 <$> call x0 cm ((tagged $ Tuple0 ) :: AggregatorFn) + +-------------------------------------------------------------------------------- +-- | ConfirmAggregatorFn +-------------------------------------------------------------------------------- + + +type ConfirmAggregatorFn = Tagged (SProxy "confirmAggregator(address)") (Tuple1 (Tagged (SProxy "_aggregator") Address)) + +confirmAggregator :: TransactionOptions NoPay -> { _aggregator :: Address } -> Web3 HexString +confirmAggregator x0 r = uncurryFields r $ confirmAggregator' x0 + where + confirmAggregator' :: TransactionOptions NoPay -> (Tagged (SProxy "_aggregator") Address) -> Web3 HexString + confirmAggregator' y0 y1 = sendTx y0 ((tagged $ Tuple1 y1) :: ConfirmAggregatorFn) + +-------------------------------------------------------------------------------- +-- | DecimalsFn +-------------------------------------------------------------------------------- + + +type DecimalsFn = Tagged (SProxy "decimals()") (Tuple0 ) + +decimals :: TransactionOptions NoPay -> ChainCursor -> Web3 (Either CallError (UIntN (DOne D8))) +decimals x0 cm = map unTuple1 <$> call x0 cm ((tagged $ Tuple0 ) :: DecimalsFn) + +-------------------------------------------------------------------------------- +-- | DescriptionFn +-------------------------------------------------------------------------------- + + +type DescriptionFn = Tagged (SProxy "description()") (Tuple0 ) + +description :: TransactionOptions NoPay -> ChainCursor -> Web3 (Either CallError String) +description x0 cm = map unTuple1 <$> call x0 cm ((tagged $ Tuple0 ) :: DescriptionFn) + +-------------------------------------------------------------------------------- +-- | GetAnswerFn +-------------------------------------------------------------------------------- + + +type GetAnswerFn = Tagged (SProxy "getAnswer(uint256)") (Tuple1 (Tagged (SProxy "_roundId") (UIntN (D2 :& D5 :& DOne D6)))) + +getAnswer :: TransactionOptions NoPay -> ChainCursor -> { _roundId :: (UIntN (D2 :& D5 :& DOne D6)) } -> Web3 (Either CallError (IntN (D2 :& D5 :& DOne D6))) +getAnswer x0 cm r = uncurryFields r $ getAnswer' x0 cm + where + getAnswer' :: TransactionOptions NoPay -> ChainCursor -> (Tagged (SProxy "_roundId") (UIntN (D2 :& D5 :& DOne D6))) -> Web3 (Either CallError (IntN (D2 :& D5 :& DOne D6))) + getAnswer' y0 cm' y2 = map unTuple1 <$> call y0 cm' ((tagged $ Tuple1 y2) :: GetAnswerFn) + +-------------------------------------------------------------------------------- +-- | GetRoundDataFn +-------------------------------------------------------------------------------- + + +type GetRoundDataFn = Tagged (SProxy "getRoundData(uint80)") (Tuple1 (Tagged (SProxy "_roundId") (UIntN (D8 :& DOne D0)))) + +getRoundData :: TransactionOptions NoPay -> ChainCursor -> { _roundId :: (UIntN (D8 :& DOne D0)) } -> Web3 (Either CallError (Tuple5 (UIntN (D8 :& DOne D0)) (IntN (D2 :& D5 :& DOne D6)) (UIntN (D2 :& D5 :& DOne D6)) (UIntN (D2 :& D5 :& DOne D6)) (UIntN (D8 :& DOne D0)))) +getRoundData x0 cm r = uncurryFields r $ getRoundData' x0 cm + where + getRoundData' :: TransactionOptions NoPay -> ChainCursor -> (Tagged (SProxy "_roundId") (UIntN (D8 :& DOne D0))) -> Web3 (Either CallError (Tuple5 (UIntN (D8 :& DOne D0)) (IntN (D2 :& D5 :& DOne D6)) (UIntN (D2 :& D5 :& DOne D6)) (UIntN (D2 :& D5 :& DOne D6)) (UIntN (D8 :& DOne D0)))) + getRoundData' y0 cm' y2 = call y0 cm' ((tagged $ Tuple1 y2) :: GetRoundDataFn) + +-------------------------------------------------------------------------------- +-- | GetTimestampFn +-------------------------------------------------------------------------------- + + +type GetTimestampFn = Tagged (SProxy "getTimestamp(uint256)") (Tuple1 (Tagged (SProxy "_roundId") (UIntN (D2 :& D5 :& DOne D6)))) + +getTimestamp :: TransactionOptions NoPay -> ChainCursor -> { _roundId :: (UIntN (D2 :& D5 :& DOne D6)) } -> Web3 (Either CallError (UIntN (D2 :& D5 :& DOne D6))) +getTimestamp x0 cm r = uncurryFields r $ getTimestamp' x0 cm + where + getTimestamp' :: TransactionOptions NoPay -> ChainCursor -> (Tagged (SProxy "_roundId") (UIntN (D2 :& D5 :& DOne D6))) -> Web3 (Either CallError (UIntN (D2 :& D5 :& DOne D6))) + getTimestamp' y0 cm' y2 = map unTuple1 <$> call y0 cm' ((tagged $ Tuple1 y2) :: GetTimestampFn) + +-------------------------------------------------------------------------------- +-- | LatestAnswerFn +-------------------------------------------------------------------------------- + + +type LatestAnswerFn = Tagged (SProxy "latestAnswer()") (Tuple0 ) + +latestAnswer :: TransactionOptions NoPay -> ChainCursor -> Web3 (Either CallError (IntN (D2 :& D5 :& DOne D6))) +latestAnswer x0 cm = map unTuple1 <$> call x0 cm ((tagged $ Tuple0 ) :: LatestAnswerFn) + +-------------------------------------------------------------------------------- +-- | LatestRoundFn +-------------------------------------------------------------------------------- + + +type LatestRoundFn = Tagged (SProxy "latestRound()") (Tuple0 ) + +latestRound :: TransactionOptions NoPay -> ChainCursor -> Web3 (Either CallError (UIntN (D2 :& D5 :& DOne D6))) +latestRound x0 cm = map unTuple1 <$> call x0 cm ((tagged $ Tuple0 ) :: LatestRoundFn) + +-------------------------------------------------------------------------------- +-- | LatestRoundDataFn +-------------------------------------------------------------------------------- + + +type LatestRoundDataFn = Tagged (SProxy "latestRoundData()") (Tuple0 ) + +latestRoundData :: TransactionOptions NoPay -> ChainCursor -> Web3 (Either CallError (Tuple5 (UIntN (D8 :& DOne D0)) (IntN (D2 :& D5 :& DOne D6)) (UIntN (D2 :& D5 :& DOne D6)) (UIntN (D2 :& D5 :& DOne D6)) (UIntN (D8 :& DOne D0)))) +latestRoundData x0 cm = call x0 cm ((tagged $ Tuple0 ) :: LatestRoundDataFn) + +-------------------------------------------------------------------------------- +-- | LatestTimestampFn +-------------------------------------------------------------------------------- + + +type LatestTimestampFn = Tagged (SProxy "latestTimestamp()") (Tuple0 ) + +latestTimestamp :: TransactionOptions NoPay -> ChainCursor -> Web3 (Either CallError (UIntN (D2 :& D5 :& DOne D6))) +latestTimestamp x0 cm = map unTuple1 <$> call x0 cm ((tagged $ Tuple0 ) :: LatestTimestampFn) + +-------------------------------------------------------------------------------- +-- | OwnerFn +-------------------------------------------------------------------------------- + + +type OwnerFn = Tagged (SProxy "owner()") (Tuple0 ) + +owner :: TransactionOptions NoPay -> ChainCursor -> Web3 (Either CallError Address) +owner x0 cm = map unTuple1 <$> call x0 cm ((tagged $ Tuple0 ) :: OwnerFn) + +-------------------------------------------------------------------------------- +-- | PhaseAggregatorsFn +-------------------------------------------------------------------------------- + + +type PhaseAggregatorsFn = Tagged (SProxy "phaseAggregators(uint16)") (Tuple1 (UIntN (D1 :& DOne D6))) + +phaseAggregators :: TransactionOptions NoPay -> ChainCursor -> (UIntN (D1 :& DOne D6)) -> Web3 (Either CallError Address) +phaseAggregators x0 cm x2 = map unTuple1 <$> call x0 cm ((tagged $ Tuple1 x2) :: PhaseAggregatorsFn) + +-------------------------------------------------------------------------------- +-- | PhaseIdFn +-------------------------------------------------------------------------------- + + +type PhaseIdFn = Tagged (SProxy "phaseId()") (Tuple0 ) + +phaseId :: TransactionOptions NoPay -> ChainCursor -> Web3 (Either CallError (UIntN (D1 :& DOne D6))) +phaseId x0 cm = map unTuple1 <$> call x0 cm ((tagged $ Tuple0 ) :: PhaseIdFn) + +-------------------------------------------------------------------------------- +-- | ProposeAggregatorFn +-------------------------------------------------------------------------------- + + +type ProposeAggregatorFn = Tagged (SProxy "proposeAggregator(address)") (Tuple1 (Tagged (SProxy "_aggregator") Address)) + +proposeAggregator :: TransactionOptions NoPay -> { _aggregator :: Address } -> Web3 HexString +proposeAggregator x0 r = uncurryFields r $ proposeAggregator' x0 + where + proposeAggregator' :: TransactionOptions NoPay -> (Tagged (SProxy "_aggregator") Address) -> Web3 HexString + proposeAggregator' y0 y1 = sendTx y0 ((tagged $ Tuple1 y1) :: ProposeAggregatorFn) + +-------------------------------------------------------------------------------- +-- | ProposedAggregatorFn +-------------------------------------------------------------------------------- + + +type ProposedAggregatorFn = Tagged (SProxy "proposedAggregator()") (Tuple0 ) + +proposedAggregator :: TransactionOptions NoPay -> ChainCursor -> Web3 (Either CallError Address) +proposedAggregator x0 cm = map unTuple1 <$> call x0 cm ((tagged $ Tuple0 ) :: ProposedAggregatorFn) + +-------------------------------------------------------------------------------- +-- | ProposedGetRoundDataFn +-------------------------------------------------------------------------------- + + +type ProposedGetRoundDataFn = Tagged (SProxy "proposedGetRoundData(uint80)") (Tuple1 (Tagged (SProxy "_roundId") (UIntN (D8 :& DOne D0)))) + +proposedGetRoundData :: TransactionOptions NoPay -> ChainCursor -> { _roundId :: (UIntN (D8 :& DOne D0)) } -> Web3 (Either CallError (Tuple5 (UIntN (D8 :& DOne D0)) (IntN (D2 :& D5 :& DOne D6)) (UIntN (D2 :& D5 :& DOne D6)) (UIntN (D2 :& D5 :& DOne D6)) (UIntN (D8 :& DOne D0)))) +proposedGetRoundData x0 cm r = uncurryFields r $ proposedGetRoundData' x0 cm + where + proposedGetRoundData' :: TransactionOptions NoPay -> ChainCursor -> (Tagged (SProxy "_roundId") (UIntN (D8 :& DOne D0))) -> Web3 (Either CallError (Tuple5 (UIntN (D8 :& DOne D0)) (IntN (D2 :& D5 :& DOne D6)) (UIntN (D2 :& D5 :& DOne D6)) (UIntN (D2 :& D5 :& DOne D6)) (UIntN (D8 :& DOne D0)))) + proposedGetRoundData' y0 cm' y2 = call y0 cm' ((tagged $ Tuple1 y2) :: ProposedGetRoundDataFn) + +-------------------------------------------------------------------------------- +-- | ProposedLatestRoundDataFn +-------------------------------------------------------------------------------- + + +type ProposedLatestRoundDataFn = Tagged (SProxy "proposedLatestRoundData()") (Tuple0 ) + +proposedLatestRoundData :: TransactionOptions NoPay -> ChainCursor -> Web3 (Either CallError (Tuple5 (UIntN (D8 :& DOne D0)) (IntN (D2 :& D5 :& DOne D6)) (UIntN (D2 :& D5 :& DOne D6)) (UIntN (D2 :& D5 :& DOne D6)) (UIntN (D8 :& DOne D0)))) +proposedLatestRoundData x0 cm = call x0 cm ((tagged $ Tuple0 ) :: ProposedLatestRoundDataFn) + +-------------------------------------------------------------------------------- +-- | SetControllerFn +-------------------------------------------------------------------------------- + + +type SetControllerFn = Tagged (SProxy "setController(address)") (Tuple1 (Tagged (SProxy "_accessController") Address)) + +setController :: TransactionOptions NoPay -> { _accessController :: Address } -> Web3 HexString +setController x0 r = uncurryFields r $ setController' x0 + where + setController' :: TransactionOptions NoPay -> (Tagged (SProxy "_accessController") Address) -> Web3 HexString + setController' y0 y1 = sendTx y0 ((tagged $ Tuple1 y1) :: SetControllerFn) + +-------------------------------------------------------------------------------- +-- | TransferOwnershipFn +-------------------------------------------------------------------------------- + + +type TransferOwnershipFn = Tagged (SProxy "transferOwnership(address)") (Tuple1 (Tagged (SProxy "_to") Address)) + +transferOwnership :: TransactionOptions NoPay -> { _to :: Address } -> Web3 HexString +transferOwnership x0 r = uncurryFields r $ transferOwnership' x0 + where + transferOwnership' :: TransactionOptions NoPay -> (Tagged (SProxy "_to") Address) -> Web3 HexString + transferOwnership' y0 y1 = sendTx y0 ((tagged $ Tuple1 y1) :: TransferOwnershipFn) + +-------------------------------------------------------------------------------- +-- | VersionFn +-------------------------------------------------------------------------------- + + +type VersionFn = Tagged (SProxy "version()") (Tuple0 ) + +version :: TransactionOptions NoPay -> ChainCursor -> Web3 (Either CallError (UIntN (D2 :& D5 :& DOne D6))) +version x0 cm = map unTuple1 <$> call x0 cm ((tagged $ Tuple0 ) :: VersionFn) \ No newline at end of file diff --git a/stack.yaml b/stack.yaml index 89411c4..91938f6 100644 --- a/stack.yaml +++ b/stack.yaml @@ -4,5 +4,5 @@ packages: - "." extra-deps: - - git: https://github.com/charlescrain/hs-web3 - commit: 45c374cc489f25394527272cd1df911ecd6440a4 + - git: https://github.com/Pixura/hs-web3 + commit: 175ca55de9be31054a8246d8c5ed8d7ce7813d83 diff --git a/stack.yaml.lock b/stack.yaml.lock index 9746228..f58f4b5 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -7,14 +7,14 @@ packages: - completed: name: web3 version: 0.8.3.2 - git: https://github.com/charlescrain/hs-web3 + git: https://github.com/Pixura/hs-web3 pantry-tree: size: 7979 - sha256: d067c03663b38fd28c154dbd192cebf0b2d3e9d9f272ec1d01505957c2fca225 - commit: 45c374cc489f25394527272cd1df911ecd6440a4 + sha256: df9f31cdfd98dd922c28f975b766c3eaf7d8bbcc8f3e0a4919deeaa69c6810e1 + commit: 175ca55de9be31054a8246d8c5ed8d7ce7813d83 original: - git: https://github.com/charlescrain/hs-web3 - commit: 45c374cc489f25394527272cd1df911ecd6440a4 + git: https://github.com/Pixura/hs-web3 + commit: 175ca55de9be31054a8246d8c5ed8d7ce7813d83 snapshots: - completed: size: 524127 diff --git a/yarn.lock b/yarn.lock index 8f828fc..07e9a2f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -50,10 +50,10 @@ resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea" integrity sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ== -"@solidity-parser/parser@^0.11.0": - version "0.11.1" - resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.11.1.tgz#fa840af64840c930f24a9c82c08d4a092a068add" - integrity sha512-H8BSBoKE8EubJa0ONqecA2TviT3TnHeC4NpgnAHSUiuhZoQBfPB4L2P9bs8R6AoTW10Endvh3vc+fomVMIDIYQ== +"@solidity-parser/parser@^0.12.1": + version "0.12.1" + resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.12.1.tgz#10ce249890d32ba500e9ce449e60a2b26b11be7a" + integrity sha512-ikxVpwskNxEp2fvYS1BdRImnevHmM97zdPFBa1cVtjtNpoqCm/EmljATTZk0s9G/zsN5ZbPf9OAIAW4gbBJiRA== "@szmarczak/http-timer@^1.1.2": version "1.1.2" @@ -1609,10 +1609,10 @@ emoji-regex@^8.0.0: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== -emoji-regex@^9.2.1: - version "9.2.1" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.1.tgz#c9b25604256bb3428964bead3ab63069d736f7ee" - integrity sha512-117l1H6U4X3Krn+MrzYrL57d5H7siRHWraBs7s+LjRuFK7Fe7hJqnJ0skWlinqsycVLU5YAo6L8CsEYQ0V5prg== +emoji-regex@^9.2.2: + version "9.2.2" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" + integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== encodeurl@~1.0.2: version "1.0.2" @@ -3630,18 +3630,18 @@ prepend-http@^2.0.0: integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= prettier-plugin-solidity@^1.0.0-alpha.60: - version "1.0.0-beta.5" - resolved "https://registry.yarnpkg.com/prettier-plugin-solidity/-/prettier-plugin-solidity-1.0.0-beta.5.tgz#04347bc3fb8deb5d097c9c823cbc01451a40da7a" - integrity sha512-Fd0a+rF/FD7dnN/ZyaSHjH9q/onw6Qd4lzU+nIPj9FoqBkt+WDUYLpiwuVZ/I0i5hZRTVAxiwErp7qmgdyqYpA== + version "1.0.0-beta.9" + resolved "https://registry.yarnpkg.com/prettier-plugin-solidity/-/prettier-plugin-solidity-1.0.0-beta.9.tgz#462ee4db99eb8a0b186fe9b53014af5486cdccff" + integrity sha512-Y7AEF17HaFAvEPMC6UESNQwjRs5+7TQQkG6j1OW5JdDlglFm1j0kLYaK6azKvIocsKlBvuvy5a3dZL+uK0pZhg== dependencies: - "@solidity-parser/parser" "^0.11.0" + "@solidity-parser/parser" "^0.12.1" dir-to-object "^2.0.0" - emoji-regex "^9.2.1" + emoji-regex "^9.2.2" escape-string-regexp "^4.0.0" prettier "^2.2.1" - semver "^7.3.4" - solidity-comments-extractor "^0.0.4" - string-width "^4.2.0" + semver "^7.3.5" + solidity-comments-extractor "^0.0.6" + string-width "^4.2.2" prettier@^2.2.1: version "2.2.1" @@ -4131,10 +4131,10 @@ semver@^5.3.0, semver@^5.5.0, semver@^5.5.1: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== -semver@^7.3.4: - version "7.3.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.4.tgz#27aaa7d2e4ca76452f98d3add093a72c943edc97" - integrity sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw== +semver@^7.3.5: + version "7.3.5" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" + integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== dependencies: lru-cache "^6.0.0" @@ -4261,10 +4261,10 @@ solc@0.6.12, solc@^0.6: semver "^5.5.0" tmp "0.0.33" -solidity-comments-extractor@^0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/solidity-comments-extractor/-/solidity-comments-extractor-0.0.4.tgz#ce420aef23641ffd0131c7d80ba85b6e1e42147e" - integrity sha512-58glBODwXIKMaQ7rfcJOrWtFQMMOK28tJ0/LcB5Xhu7WtAxk4UX2fpgKPuaL41XjMp/y0gAa1MTLqk018wuSzA== +solidity-comments-extractor@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/solidity-comments-extractor/-/solidity-comments-extractor-0.0.6.tgz#8cd0d0394a9c3ff9185fc83d48d75b6cd19dd358" + integrity sha512-5GRv062LXC+8sJZS3wlY4ZptKFODf+jTDqxB64DWf/uyAL5ZJEvmr8wW3Kd/V+e5roBShcC15+ThfGMerF2Yxw== source-map-support@^0.4.15: version "0.4.18" @@ -4353,10 +4353,10 @@ string-width@^3.0.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" -string-width@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" - integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== +string-width@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.2.tgz#dafd4f9559a7585cfba529c6a0a4f73488ebd4c5" + integrity sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA== dependencies: emoji-regex "^8.0.0" is-fullwidth-code-point "^3.0.0"