Skip to content

Files

Latest commit

 

History

History

factory

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

ARC1 Token Factory

It is a contract that is used to create ARC1 token contracts

We create a new token by calling the new_token function and informing the arguments:

  • Name
  • Symbol
  • Decimals
  • Initial Supply
  • Options (optional)
  • Owner (optional)

The options is a table informing which extensions to add to the token:

  • burnable
  • mintable
  • blacklist
  • pausable
  • all_approval
  • limited_approval

The owner is the address that will be registered as the owner of the token contract. By default it is the entity calling the factory, but we can specify any address.

Creating from another contract

The call uses this format:

contract.call(arc1_factory, "new_token", name, symbol, decimals,
              initial_supply, options)

The function returns the contract address.

Here is an example:

local token = contract.call(arc1_factory, "new_token", name, symbol, 18,
                            '1000000', {mintable=true,burnable=true})

And how to inform a max supply (for mintable tokens):

local token = contract.call(arc1_factory, "new_token", name, symbol, 18,
                            '1000000', {mintable=true,max_supply='5000000'})

⚠️ The initial_supply and max_supply should NOT contain the decimal part!

They can be either string or bignum.

The factory can also be called from herajs, herapy, libaergo...

Token Factory Address

testnetAmgSDUteTX3oRdQKUqChQjjdw5roEuxtFxYh8DLpQ29PRNeBWtjj
alphanetAmgcqYVDY9tzuv65QxeX5SrW43KJ3uQuzACZn9KQPqSxtLbR8NvC

Updating the Factory

If some of the contract files were modified, you can build a new factory and deploy it.

Then update the services that use it to point to the new address.

Deploy the Factory

Run:

./build.sh

Then deploy the generated ARC1-Factory.lua to the desired blockchain network.