How can DAOs leverage Mintbase’s toolkit?

Maria Neu
Mintbase
Published in
8 min readApr 12, 2022

--

Everything you do on Mintbase, you can do via code. Still, if you are not a coder, like me who is writing to you, this does not make us jump right in, does it?

Gladly for us, this can be done easily even by non-coders. Learn how in this article :)

The fact that everyone can interact with Mintbase’s open source contracts means that DAOs on NEAR can do anything they want on Mintbase — via custom function calls.

What are Custom Function Calls (CFC)? A way to insert code into proposals on the AstroDAO Dapp — which will fire up actions on mintbaseJS.

So DAOs can — mint, buy, transfer, burn, list NFTs for sale, create smart contracts, add minters to that smart contract, remove minters from that smart contract, send funds to that smart contract, and even transfer the ownership of the smart contract to another wallet or DAO.

This means that the funds used will not be of the user / proposer of the function call — but the DAOs.

Every store on Mintbase is its own smart contract. You can interact with this smart contract via the Mintbase.io UI on both testnet and mainnet. Or — you know it by now — via code.

There are two options for DAOs to act on top of the smart contracts. Either the DAO is added as a minter via the UI, or the DAO is the creator of the smart contract.

This article is divided into 13 parts,

  1. How to create a custom function call
  2. How to get the information needed (method name, JSON)
  3. Finding Token Key
  4. Buy NFT
  5. Mint NFT
  6. Transfer NFT
  7. Burn NFT
  8. List NFT for Simple Sale
  9. List NFT in an Auction
  10. Create a Smart Contract = Store on Mintbase
  11. Add minters to that Contract
  12. Remove minters from the Contract
  13. Transfer Store Ownership to a wallet or a DAO

1. How to create a custom function call on AstroDAO?

When you go to app.astrodao.com and select any DAO — we will be using the MintbaseDAO as an example here, you will be confronted with the following visual

Clicking on the green plus will open another window which is by default: Propose a Transfer.

We do not want to propose transfer now — we are looking into CUSTOM FUNCTION CALLS — which is the last option when clicking on “Propose a Transfer”.

When you click custom function call you will see this template:

Above you can see several fields that need to be filled in:

  • The description (free for you to choose)
  • A link (purple) to insert (optional)
  • The smart contract address on which the action should be fulfilled
  • The method name you want to realize
  • The JSON — the bit of code needed
  • The deposit — how much near that action will cost — will be taken off the DAOs treasury
  • The Tgas (2x) — gas needed for the transaction

Important note: only the last vote — which will effectively realize the action you are trying to take — will actually interact with the mintbase protocol. Therefore the last vote often needs more gas than the normal voting votes if that makes sense :). So keep in mind that you can use 300tgas for the last vote for pretty much every CFC.

2. How to get the information needed (method name, JSON)

This article is supposed to be a cheat sheet so you do have a place to verify that the JSON and method name you are using are right. Still — for every custom function call described here, you will need to do a certain set of steps:

You need to have a near wallet

You need to sign in to mintbase with that near wallet

You need to pretend to do any action you want to via the DAO with that individual wallet. (Minting, listing for sale, anything you want to do really)

Then, when you click mint, deploy, transfer, list, etc, you’ll be redirected to the near wallet page.

Click “more information” below the transaction costs and your ballance

Click on the method name (make_offer, nft_batch_mint, create_store, etc)

The JSON will be displayed. Copy everything without the word ‘Arguments’. From “{“ to “}”.

3. Finding Token Key

Go to the Thing page like this one and scroll down to ‘Token ID’ and click ‘Multiple Tokens’:

The Token key is a combinations of the smart contract and the tokenId. So tokenId + : + contract name.

You can find the contract name in the “details” below.

A token Key can look like: “18:mintbase.mintbase1.near”

4. Buy NFT

Select the dropdown “Proposal Type and select Custom Function Call”

Here you need to fill in:

Description

  • (whatever you want to write there… example: Buying NFT from X)

Deposit: Value of the NFT to be bought. You can deposit a little bit more

Tgas x2: 100

Last vote 300

Link of a successful buy

5. Mint NFT

If you want to Mint on Mintbase via the DAO, the DAO needs to be added as a minter via the UI or via CFC. CFC only makes sense if a DAO is the owner of the store — because only the owner can access the settings — in other words: has the right to change the smart contracts proprieties.

When you mint an NFT on Mintbase via CFC, you need to actually go to mintbase.io, realize the action you want to do but not approve it. Instead of approving it, you will click on more information and discover the method name & the JSON.

You can change some things about the JSON. For example, you can change the owner_id and the num_to_mint. I would not recommend messing around with it too much though…

An example:

  • Method name:
nft_batch_mint
  • JSON
{"owner_id": "mariamneu.near","metadata": {"reference": "cY7KvY5ncw9JrbPkSuk3gSnJqd5eKcM_K87YvY1fgbg","extra": null},"num_to_mint": 1,"royalty_args": {"split_between": { "mintbase2.near": 3000, "mariamneu.near": 7000 },"percentage": 1000},"split_owners": { "mintbase2.near": 3000, "mariamneu.near": 7000 }}
  • Smart contract: the store you want to mint it on. In this case it was reginamintbase.mintbase1.near
  • Tgas: 30 (in both Tgas fields)
  • Deposit: 0,1N

Last vote 300 gas

Link to a successful mint.

6. Transfer NFT

The DAO needs to OWN the NFT to be able to transfer it to someone/someDAO else. You can transfer the NFT to the DAO via the Mintbase UI really easily.

  • Method name
nft_transfer
  • JSON:
{"receiver_id": "mintbase2.near","token_id": "24"}
  • Smart contract: where the NFT was minted on. In this case: reginamintbase.mintbase1.near
  • Tgas 30
  • Deposit : 1 yoctoNEAR (0,000000000000000000000001 )

Last vote was 300

Link to successful transfer

7. List — Simple Sale

The DAO you are proposing to needs to own the NFT to be able to list it.

  • Method name
nft_approve
  • JSON:
{"token_id": "3","account_id": "market.mintbase1.near","msg": "{\"price\":\"5000000000000000000000000\",\"autotransfer\":true}"}
  • Smart contract: the store the NFT was minted on. In this case it was reginamintbase.mintbase1.near
  • Tgas 200
  • Deposit 0.00081

Last vote 300

Link to a successful list.

8. List — Auction

DAO needs to own the NFT to be able to list it.

  • Method name
nft_approve
  • JSON
{"token_id": "3","account_id": "market.mintbase1.near","msg": "{\"price\":\"4000000000000000000000000\",\"autotransfer\":false}"}
  • Smart contract: the store the NFT was minted on. In this case it was reginamintbase.mintbase1.near
  • Tgas 200
  • Deposit 0.00081

Last vote 300 gas

Link to successful list for auction

9. Burn

DAO needs to own the NFT to be able to burn it.

  • Method name:
nft_batch_burn
  • JSON:
{
“token_ids”: [“79”]
}
  • Smart contract: the store the NFT was minted on. In this case it was reginamintbase.mintbase1.near
  • Deposit: EXACTLY one yoctonear. 0,000000000000000000000001
  • Gas 200

Last vote 300

Link to successful CFC

10. Create store

The funds will go from the DAO, so the DAO needs to have 12N to create a store. 6.5 for the store and there always need to be 5N in the treasury.

Store name & Symbol needs to be small letters.

Change the owner_id to your DAOs address (example: mintbase.sputnik-dao.near) if you want your DAO to own the store.

If you keep the personal wallet in there you will be the owner of the store but the daos treasury will have been used for it.

  • Method name:
create_store
  • JSON:
{"owner_id": "YOUR DAO.near","metadata": {"spec": "nft-1.0.0","name": "nameofyourstore","symbol": "up to four letters/numbers","icon": "data:image/x-icon;base64,AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAJCT/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAEQAAAAEAEAEAEAAAAQAQAQAQAAAAEREREQAAAAAAEAAAAAAAAAAQAAAAAAAAABEQAAEQAAAAEAEAEAEAAAAQAQAQAQAAAAEREREQAAAAAAAAEAAAAAAAAAAQAAAAAAAAERAAAAAAAAEAEAAAAAAAAQAQAAAAAAAAEQAADnnwAA228AANtvAADgHwAA+/8AAPv/AAD48wAA+20AAPttAAD8AwAA/+8AAP/vAAD/jwAA/28AAP9vAAD/nwAA","base_uri": "https://arweave.net","reference": null,"reference_hash": null}}
  • Smart contract: mintbase1.near
  • Tgas 200
  • Deposit 6.5

Link to successful deployment

11. Add minter

To add minters to the store, the DAO needs to be the owner of the store/smart contract.

  • Method name
grant_minter
  • JSON
{
"account_id": "mintbase2.near"
}
  • Smart contract: the store. Example: mintbasestrodao.mintbase1.near
  • Tgas 30
  • Deposit 1 yoctoNEAR, but store might run out of storage stake. 0,000000000000000000000001

Link to successful addition of a minter

12. Remove minter

To remove minters from the store, the DAO needs to be the owner of the store/smart contract.

  • Method name
revoke_minter
  • JSON
{ "account_id": "mintbasecommunity.near" }

Smart contract: the store. Example: mintbasestrodao.mintbase1.near

  • Tgas 30
  • Deposit 1 yoctoNEAR, 0,000000000000000000000001 but the call actually frees up previously used storage stake

Link to successful removal of minter

13. Transfer store ownership

The DAO needs to own the store to be able to transfer it to another wallet or DAO.

We recommend the store to be owned by an individiual wallet at least at one moment, because there are things you can only do via the UI. For example: adding a store header image, a name to the store, a description of the store, setting up default royalties & revenues, adding links… These are all actions that happen exclusively on the UI, not on the Blockchain. So that’s why CFCs can’t to that.

  • Method name
transfer_store_ownership
  • JSON
{
"new_owner": "mintbase2.near",
"keep_old_minters": true
}
  • Smart contract: the store. Example: mintbaseastrodao.mintbase1.near
  • Tgas 30
  • Deposit 1 yoctoNEAR. 0,000000000000000000000001

Link to a successful store ownership transferral

NOTE: The yoctoNEAR deposit on some method is an enhanced method of authentication. When you see 1 yoctoNEAR being required, that means we really want you to verify that it’s you calling the method.

--

--

Maria Neu
Mintbase

Partnerships Manager @ Mintbase / MintbaseDAO facilitator