Serverless Faucet on Aptos. Allow anyone to create aptos faucet token and mint it freely.
In common practice, a faucet of a certain coin on Aptos will require a dedicated server to store the private key of the minter account, and handle the request from external users. However this is inefficient since it will need to setup an additional server to handle the request.
AnyFaucet
propose a serverless solution that not a dedicated server is needed to handle mint request, but only interact with smart contract. For details, please check out the code.
AnyFaucet can work in one of two modes: FaucetCoin
mode or FreeCoin
mode.
The difference between the two is how to claim test coins.
In FaucetCoin
mode, AnyFaucet act as coin factory
and coin minter
.
To mint coins, you should call AnyFauct.claim<CoinType>(...)
.
In FreeCoin
mode, AnyFaucet just act as coin factory
, and coin minter
is coin itself!
To mint coins, you should call coin.claim(...)
.
run npm install
or yarn
- create address:
aptos init
- faucet more coin:
yarn faucet $account
- replace
faucet
in./move/faucet/Move.toml
by the created account
- deploy:
yarn deploy
- init faucet:
yarn faucet_init [$useFreeCoin]
- useFreeCoin(bool): 'true' will work in
FreeCoin
mode, omit or 'false' will work inFaucetCoin
mode.
- useFreeCoin(bool): 'true' will work in
cmd: yarn coin_new $name $symbol $decimals $monitor_supply $mint_rate
- name(string): name of token
- symbol(string): symbol of token
- decimals(number): decimals of token
- monitor_supply(bool): indicate if it monitors total supply
- mint_rate(number): maximum amount of a single mint
example: yarn coin_new Bitcoin BTC 8 true 10000000
cmd: yarn coin_list
example output:
---------------------------------------------------------------------------------------------------- 0
coin type(FaucetCoin): 0x3fc2de7809febca39a15e80804c1c803c18d19896c89c3e288f1a13baed1f886::faucet_coin::Coin
coin type(FreeCoin): 0x3fc2de7809febca39a15e80804c1c803c18d19896c89c3e288f1a13baed1f886::free_coin::Coin
coin meta: {
decimals: 8,
mint_rate: '10000',
monitor_supply: true,
name: 'Bitcoin',
symbol: 'BTC'
}
cmd: yarn coin_claim $coin_type
- coin_type(string): you can find it in
coin_list
example: yarn coin_claim 0x3fc2de7809febca39a15e80804c1c803c18d19896c89c3e288f1a13baed1f886::faucet_coin::Coin
- Use at your own risk.
- Coin has unlimited supply.