Create Pool

Package:

  • v1.0.0

  • v1.1.0

  • v1.1.1

CALL_METHOD
	Address("${account_address}")
		"withdraw"
		Address("${token1_resource_adddress}")
		Decimal("${token1_initial_liquidity_amount}");
TAKE_FROM_WORKTOP
	Address("${token1_resource_adddress}")
	Decimal("${token1_initial_liquidity_amount}")
	Bucket("bucket1");

CALL_METHOD
	Address("${account_address}")
		"withdraw"
		Address("${token2_resource_adddress}")
		Decimal("${token2_initial_liquidity_amount}");
		
TAKE_FROM_WORKTOP
	Address("${token2_resource_adddress}")
	Decimal("${token2_initial_liquidity_amount}")
	Bucket("bucket2");

# you can have as much tokens as you wish by repeating the previous two instructions for every token, but they must fullfill the conditions: 1. be fungible tokens, 2. at least two tokens, 3. buckets names to be different for each token, 4.provide non-zero initial liquidity, 

CALL_FUNCTION
    Address("${package_address}")
		"FullRangePool"
		"new"
			Tuple
			(
				"friendly name",          # pool_name, used to make the pool easily distigishable by users
				Array<Bucket>(Bucket("bucket1"), Bucket("bucket2")),      # initial liquidity buckets
				Enum<0u8>(),             # PoolType, FullRange
				Enum<1u8>(),             # PoolLiquidityType, 0: Private, 1: Public
				Array<Enum>                 # rules
				(
					Enum<0u8>			# type of the rule, currently only one type supported: 0: FeeRule
					(
						Tuple
						(
							Enum<0u8>(),	# Fee rule type, 0: Percentage, 1: Fixed
							Decimal("0.005"),		# Fee rule value
							None,					# Token resource address, used primarity with fixed fee rules, either None, or Some(Address("${token_resource_address}"))
							Enum<0u8>()				# Fee collection strategy, 0: AddToLiquidity, 1: AddToWithdrawableProfits, 2: AddToPoolManagerFees
						)
					),
				)
			);
CALL_METHOD
	Address("${account_address}")
		"try_deposit_batch_or_refund"
		Expression("ENTIRE_WORKTOP")
		Enum<0u8>();


Package:

  • v2.0.0

	Address("${account_address}")
		"withdraw"
		Address("${token1_resource_adddress}")
		Decimal("${token1_initial_liquidity_amount}");
TAKE_FROM_WORKTOP
	Address("${token1_resource_adddress}")
	Decimal("${token1_initial_liquidity_amount}")
	Bucket("bucket1");

CALL_METHOD
	Address("${account_address}")
		"withdraw"
		Address("${token2_resource_adddress}")
		Decimal("${token2_initial_liquidity_amount}");
		
TAKE_FROM_WORKTOP
	Address("${token2_resource_adddress}")
	Decimal("${token2_initial_liquidity_amount}")
	Bucket("bucket2");

# you can have as much tokens as you wish by repeating the previous two instructions for every token, but they must fullfill the conditions: 1. be fungible tokens, 2. at least two tokens, 3. buckets names to be different for each token, 4.provide non-zero initial liquidity, 

CALL_FUNCTION
    Address("${package_address}")
		"FullRangePool"
		"new"
			Tuple
			(
				"friendly name",          # pool_name, used to make the pool easily distigishable by users
				Array<Tuple>(      # initial_liquidity
                			Tuple(
                				Bucket("bucket1"),
                				Some(Decimal("0.5"))		# token weight, None for Standard pools, Some(...) for Index pools
                			),
                                	Tuple(
                                		Bucket("bucket2"),
                                		Some(Decimal("0.5"))
                                	)
            			),
				Enum<0u8>(),             # PoolType, 0 for Standard Pool, 1 for Index Pool
				Enum<1u8>(),             # PoolLiquidityType, 0: Private, 1: Public
				Array<Enum>                 # rules
				(
					Enum<0u8>			# type of the rule, currently only one type supported: 0: FeeRule
					(
						Tuple
						(
							Enum<0u8>(),	# Fee rule type, 0: Percentage, 1: Fixed
							Decimal("0.005"),		# Fee rule value
							None,					# Token resource address, used primarity with fixed fee rules, either None, or Some(Address("${token_resource_address}"))
							Enum<0u8>()				# Fee collection strategy, 0: AddToLiquidity, 1: AddToWithdrawableProfits, 2: AddToPoolManagerFees
						)
					),
				),
			        Some(Tuple(            # IndexPoolOptions, None for Standard pool, Some(...) for Index pool
			            true                # enable_weights_changing
			        ))
			);
CALL_METHOD
	Address("${account_address}")
		"try_deposit_batch_or_refund"
		Expression("ENTIRE_WORKTOP")
		Enum<0u8>();

Last updated