Skip to content

Commit

Permalink
Pact 4.2.1 and xchain cap (#763)
Browse files Browse the repository at this point in the history
* bump kpkgs and pact

* new-crosschain cap and gas-station

* switch to new gas-station

Co-authored-by: jmininger <no email>
  • Loading branch information
jmininger authored Apr 21, 2022
1 parent 9190d81 commit 4598d73
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions dep/kpkgs/github.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"repo": "kpkgs",
"branch": "master",
"private": false,
"rev": "763f1763207a02fbf6257bd8e2a8cef2a9f86e1d",
"sha256": "1dncp11hn65dvwpqrw3di6hdlykjpgc0w0ii5lvwdziac861ak2n"
"rev": "905ac27a05db959db3ce27c4f258310746a9f12b",
"sha256": "0mw6zsxkc93pqravvjmjiaq3bhydfabkvh12wbndj2jgv3i4z3qx"
}
4 changes: 2 additions & 2 deletions dep/pact/github.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"repo": "pact",
"branch": "master",
"private": false,
"rev": "51f8d6eeca1a8cff11d2fda5446522a4148f785c",
"sha256": "0zrc720f86zz2zqbmcmc8qh84fwsx6hdmlwi0n9cdi38yz3ybkcq"
"rev": "1c517a906b2b6d0c8a4cdb107ffbc00887a9ac62",
"sha256": "0ssc2gh3cfavczwkqqprc145xa146jj8syv4h1svcpmxfjbprg40"
}
18 changes: 11 additions & 7 deletions frontend/src/Frontend/UI/Transfer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ gasPayersSection model netInfo fks tks ti = do
Just (AccountStatus_Exists dets)
-- TODO: Check if it's a k-account owned by chainweaver
| _accountDetails_balance dets > AccountBalance 0 -> Just toAccount
_ -> Just $ AccountName "free-x-chain-gas"
_ -> Just $ AccountName "kadena-xchain-gas"

getGasPayerKeys chain = maybe (pure never) $ \gp -> do
-- I think lookupKeySets can't be done in the PushM monad
Expand Down Expand Up @@ -1217,10 +1217,14 @@ transferCapability from to amount = SigCapability
]
}

crosschainCapability :: AccountName -> SigCapability
crosschainCapability from = SigCapability
{ _scName = QualifiedName { _qnQual = "coin", _qnName = "DEBIT", _qnInfo = def }
, _scArgs = [PLiteral $ LString $ unAccountName from]
crosschainCapability :: AccountName -> AccountName -> Decimal -> ChainId -> SigCapability
crosschainCapability from to amount chain = SigCapability
{ _scName = QualifiedName { _qnQual = "coin", _qnName = "TRANSFER_XCHAIN", _qnInfo = def }
, _scArgs = [ PLiteral $ LString $ unAccountName from
, PLiteral $ LString $ unAccountName to
, PLiteral $ LDecimal amount
, PLiteral $ LString $ _chainId chain
]
}

gasCapability :: SigCapability
Expand Down Expand Up @@ -1326,7 +1330,7 @@ transferMetadata model netInfo fks tks ti ty = do
amount = if ty == SafeTransfer then rawAmount + safeTransferEpsilon else rawAmount
transferCap = if fromChain == toChain
then transferCapability fromAccount toAccount amount
else crosschainCapability fromAccount
else crosschainCapability fromAccount toAccount amount toChain
fromCapsA = foldr (addCap transferCap) <$> gasCaps <*> fromTxKeys
allFromCaps = if ty == SafeTransfer
then foldr (addCap (transferCapability toAccount fromAccount safeTransferEpsilon))
Expand Down Expand Up @@ -1354,7 +1358,7 @@ transferMetadata model netInfo fks tks ti ty = do
then Just 1200
else if fromChain == toChain
then Just 600
else Just 400 -- Cross-chains need to be under 400 in order to use gas-station
else Just 450 -- Cross-chains need to be under 450 in order to use gas-station
(conf, ttl, lim, price) <- uiMetaData model Nothing defaultLimit
elAttr "div" ("style" =: "margin-top: 10px") $ do
now <- fmap round $ liftIO $ getPOSIXTime
Expand Down

0 comments on commit 4598d73

Please sign in to comment.