Examples

We will help you better understand the working principle of brc-202 through the following examples. Besides, you must be aware that brc-202 is an experimental standard, and use it at your own risk.

Regular Examples

As the initiator, you need to deploy in the following steps to launch an IDO

  • Step 1: The initiator fills the necessary information into the DeployToken function, and transfers the tokens used for the IDO to the specified address at one time.

{
	"p": "brc-202",
	"op": "DeployToken",
	"tick": "ordi",
	"amt": "21000000",
	"to": " ",
	},
}
  • Since you have not set other receiving addresses, the default receiving address is the calling address

  • At this time, the calling address will have 21,000,000 "ordi"

User

Initial Balance

Final Balance

IDO Initiator

0

21,000,000

  • Step 2: Launch an IDO, fill the necessary information into the DeployIDO function, such as: IDO price, maximum amount for a single subscription, the end time of the IDO, etc.

{
	"p": "brc-202",
	"op": "DeployIDO",
	"tick": "ordi",
	"content": {
		"price": "0.000001",
		"max": "10000",
		"totalToken": "1000000",
		"notary": "address",
		"end": "840,000",
		},
	}
  • “price” is the single purchase price of the IDO, which is 0.000001BTC at this time

  • “max” is the number of single purchases, which is 10,000 "ordi" at this time

  • “totalToken” is the maximum supply of this IDO

    • Check that the token balance of the receiving address in the DeployToken function is greater than totalToken

    • totalToken will be recorded to the notary address, which is equivalent to giving the inscription to the notary address

  • “notary” is the notary address, used to accept the IDO amount, it is recommended to use a multi-signature wallet, or a platform-managed address

    • The notary address is the unique identifier of this IDO, and each notary address can only be used once

As a subscriber, you need to complete the following operation steps to participate in the IDO.

  • After the deployment work of the IDO initiator is completed, the subscriber fills the necessary information into the DeclareIDO function to participate in the IDO

{
	"p": "brc-202",
	"op": "DeclareIDO",
	"tick": "ordi",
	"content": {
		"amt": "10",
		"totalBTC": "0.00001",
		"to": "840,000"
		},
	}
  • “amt” is the number of IDO subscriptions

  • Require the BTC amount transferred out when calling this method to be consistent with the totalBTC amount, and the BTC receiving address is the notary's receiving address

  • It will not be possible to apply after the end block 840,000

After the IDO ends, the notary needs to complete the following operation steps to distribute the IDO share to the subscribers in turn.

  • The ApproveIDO function is triggered by the notary address. If the content of approveIDO is consistent with the content of DeclareIDO, and BTC is received, it is almost equivalent to transferring coins to the declare address.

{
	"p": "brc-202",
	"op": "ApproveIDO",
	"tick": "ordi",
	"content": {
		"amt": "10",
		"totalBTC": "0.00001",
		"to": "the receiving address"
		},
}
UserInitial BalanceFinal Balance

IDO Subscriber

0

100,000

  • We have provided a convenient BatchTransfer function, which can batch transfer the IDO tokens to all addresses that have successfully participated in the subscription. This function is triggered by the notary address

{
"p": "brc-202",
"op": "BatchTransfer",
"tick": "ordi",
"content": {
"address1": "amount1",
"address2": "amount2",
"address3": "amount3",
"address4": "amount4"
	},
}
  • The notary address calls this method to destroy the remaining tokens after the IDO ends, of course, you can choose not to use this function.

{
"p": "brc-202",
"op": "burn",
"tick": "ordi",
"amt": "100",
}

Last updated