TokenFactory Core (middleware)
This is a contract to which you give the admin of your token denomination(s) from the TokenFactory module. Once this contract has that, it allows other contracts you/your DAO controls to mint tokens for your business logic needs (via a WasmMsg).
This makes it more flexible since multiple contracts can "mint" tokens on behalf of the contract admin :D
Example Use Case
$RAC has slots & dice contracts. If every game they want to mint 1 RAC for you for playing, both slots and dice would need to be admin of the token-factory token to mint With this core contract, a single contract is an admin, then the DAO can whitelist both the dice and slots address to mint tokens on its behalf.
This way to mint $RAC natively, the dice contract would WasmMsg a mint to the core contract, to then give the user that token.
Rust Dependency
Add the following to your Cargo.toml
dependencies for a contract. Then view the Mint section of this document for how to implement it.
[]
= { = "https://github.com/CosmosContracts/tokenfactory-contracts" }
or from crates.io - https://crates.io/crates/juno-tokenfactory-core
You can view an example of how to use this in the example contract or see the e2e test for a full example in bash.
Chain Setup
Mainnet Store Code: TBD
# for uni-6 TESTNET
# update [key] here to be your local wallet's key or your wallet's address
FLAGS="--gas-prices 0.003ujuno --gas auto --gas-adjustment 1.3 --chain-id uni-6 --node https://juno-testnet-rpc.polkachu.com:443 --output json --from [key]"
# create a tokenfactory denomination via the CLI.
# factory/juno1......./abcde is your new denom
# upload this contract (skip if you use the mainnet code)
# junod tx wasm store artifacts/juno_tokenfactory_core.wasm $FLAGS
# Initialize this contract
# You may want to set this as a normal admin initially before changing its admin to a DAO
# Get the middleware contract address here
# Transfer ownership of the token to the contract
# Ensure the juno1middlewarecontract now has the admin role
How To Contract Mint
You can then mint tokens via another contract using the following example
// msg.rs - mint on behalf of the core_factory_address
// contract.rs - execute
// Ensure you added the tokenfactory-types dependency
use Mint;
MintTokens =>