mirror of
https://github.com/urbit/shrub.git
synced 2024-12-21 01:41:37 +03:00
General cleanup.
This commit is contained in:
parent
bf8a00d8dc
commit
fcdc5904e8
@ -118,23 +118,6 @@ data EthPoint = EthPoint
|
|||||||
}
|
}
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
|
||||||
data EthEventId = EthEventId
|
|
||||||
{ eeiBlock :: Atom
|
|
||||||
, eeiLog :: Atom
|
|
||||||
}
|
|
||||||
deriving (Eq, Ord, Show)
|
|
||||||
|
|
||||||
data EthBookmark = EthBookmark
|
|
||||||
{ ebHeard :: HoonSet EthEventId
|
|
||||||
, ebLatestBlock :: Atom
|
|
||||||
}
|
|
||||||
deriving (Eq, Ord, Show)
|
|
||||||
|
|
||||||
data Snap = Snap (HoonMap Ship Public)
|
|
||||||
(Dnses, HoonMap Ship EthPoint)
|
|
||||||
EthBookmark
|
|
||||||
deriving (Eq, Show)
|
|
||||||
|
|
||||||
data Dawn = MkDawn
|
data Dawn = MkDawn
|
||||||
{ dSeed :: Seed
|
{ dSeed :: Seed
|
||||||
, dSponsor :: [(Ship, EthPoint)]
|
, dSponsor :: [(Ship, EthPoint)]
|
||||||
@ -145,11 +128,8 @@ data Dawn = MkDawn
|
|||||||
}
|
}
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
|
||||||
deriveNoun ''EthEventId
|
|
||||||
deriveNoun ''EthBookmark
|
|
||||||
deriveNoun ''Dnses
|
deriveNoun ''Dnses
|
||||||
deriveNoun ''EthPoint
|
deriveNoun ''EthPoint
|
||||||
deriveNoun ''Snap
|
|
||||||
deriveNoun ''Seed
|
deriveNoun ''Seed
|
||||||
deriveNoun ''Dawn
|
deriveNoun ''Dawn
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ retrievePoint bloq azimuth ship =
|
|||||||
-- Retrieves information about all the galaxies from Ethereum.
|
-- Retrieves information about all the galaxies from Ethereum.
|
||||||
retrieveGalaxyTable :: Quantity -> Address -> Web3 (Map Ship (Rift, Life, Pass))
|
retrieveGalaxyTable :: Quantity -> Address -> Web3 (Map Ship (Rift, Life, Pass))
|
||||||
retrieveGalaxyTable bloq azimuth =
|
retrieveGalaxyTable bloq azimuth =
|
||||||
withAzimuth bloq azimuth $ M.fromList <$> mapM getRow [0..5]
|
withAzimuth bloq azimuth $ M.fromList <$> mapM getRow [0..255]
|
||||||
where
|
where
|
||||||
getRow idx = do
|
getRow idx = do
|
||||||
(encryptionKey, authenticationKey, _, _, _, _, _, cryptoSuite,
|
(encryptionKey, authenticationKey, _, _, _, _, _, cryptoSuite,
|
||||||
@ -226,9 +226,8 @@ getSponsorshipChain block azimuth = loop
|
|||||||
dawnVent :: Seed -> RIO e (Either Text Dawn)
|
dawnVent :: Seed -> RIO e (Either Text Dawn)
|
||||||
dawnVent dSeed@(Seed ship life ring oaf) = do
|
dawnVent dSeed@(Seed ship life ring oaf) = do
|
||||||
ret <- runWeb3' provider $ do
|
ret <- runWeb3' provider $ do
|
||||||
-- Block number (dBloq)
|
|
||||||
block <- blockNumber
|
block <- blockNumber
|
||||||
print ("boot: eth block: " ++ (show block))
|
print ("boot: ethereum block #" ++ (show block))
|
||||||
|
|
||||||
print "boot: retrieving azimuth contract"
|
print "boot: retrieving azimuth contract"
|
||||||
azimuth <- withAccount () $ Ens.resolve "azimuth.eth"
|
azimuth <- withAccount () $ Ens.resolve "azimuth.eth"
|
||||||
@ -236,22 +235,14 @@ dawnVent dSeed@(Seed ship life ring oaf) = do
|
|||||||
immediateSponsor <- validateShipAndGetImmediateSponsor block azimuth dSeed
|
immediateSponsor <- validateShipAndGetImmediateSponsor block azimuth dSeed
|
||||||
dSponsor <- getSponsorshipChain block azimuth immediateSponsor
|
dSponsor <- getSponsorshipChain block azimuth immediateSponsor
|
||||||
|
|
||||||
-- Retrieve the galaxy table [MUST FIX s/5/255/]
|
|
||||||
print "boot: retrieving galaxy table"
|
print "boot: retrieving galaxy table"
|
||||||
galaxyTable <- retrieveGalaxyTable block azimuth
|
dCzar <- mapToHoonMap <$> retrieveGalaxyTable block azimuth
|
||||||
let dCzar = mapToHoonMap galaxyTable
|
|
||||||
|
|
||||||
-- Read Ames domains
|
|
||||||
print "boot: retrieving network domains"
|
print "boot: retrieving network domains"
|
||||||
dTurf <- readAmesDomains block azimuth
|
dTurf <- readAmesDomains block azimuth
|
||||||
|
|
||||||
let dBloq = toBloq block
|
let dBloq = toBloq block
|
||||||
|
|
||||||
-- dNode is supposed to be a PUrl to an Ethereum node. However, it looks
|
|
||||||
-- like it's almost always Nothing. The jael side just has a default node
|
|
||||||
-- that it goes and uses when null?
|
|
||||||
let dNode = Nothing
|
let dNode = Nothing
|
||||||
|
|
||||||
pure $ MkDawn{..}
|
pure $ MkDawn{..}
|
||||||
|
|
||||||
case ret of
|
case ret of
|
||||||
|
Loading…
Reference in New Issue
Block a user