-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- adds helper to fund agoric faucet with interchain tokens - allows callers to request `OSMO`, `ATOM`, etc, via `provisionSmartWallet`
- Loading branch information
1 parent
5cafda6
commit 57cc060
Showing
7 changed files
with
135 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import type { ExecutionContext } from 'ava'; | ||
import type { Denom } from '@agoric/orchestration'; | ||
import { makeFundAndTransfer } from './ibc-transfer.js'; | ||
import type { MultichainRegistry } from './registry.js'; | ||
import type { RetryUntilCondition } from './sleep.js'; | ||
import type { AgdTools } from './agd-tools.js'; | ||
|
||
type ChainName = string; | ||
|
||
// 90% of default faucet pour | ||
const DEFAULT_QTY = (10_000_000_000n * 9n) / 10n; | ||
|
||
/** | ||
* Determines the agoric `faucet` address and sends funds to it. | ||
* | ||
* Allows use of brands like OSMO, ATOM, etc. with `provisionSmartWallet`. | ||
*/ | ||
export const makeFaucetTools = ( | ||
t: ExecutionContext, | ||
agd: AgdTools['agd'], | ||
retryUntilCondition: RetryUntilCondition, | ||
useChain: MultichainRegistry['useChain'], | ||
) => { | ||
const fundAndTransfer = makeFundAndTransfer(t, retryUntilCondition, useChain); | ||
return { | ||
/** | ||
* @param assets denom on the issuing chain | ||
* @param [qty] number of tokens | ||
*/ | ||
fundFaucet: async (assets: [ChainName, Denom][], qty = DEFAULT_QTY) => { | ||
const faucetAddr = agd.keys.showAddress('faucet'); | ||
console.log(`Faucet address: ${faucetAddr}`); | ||
|
||
for (const [chainName, denom] of assets) { | ||
await fundAndTransfer(chainName, faucetAddr, qty, denom); | ||
} | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters