FACTORY

Deploying FACTORY contract manually

sudo casper-client put-deploy \
    --chain-name chain_name \
    --node-address http://$NODE_ADDRESS:7777/ \
    --secret-key path_to_secret_key.pem \
    --session-path path_to_wasm_file \
    --payment-amount 10000000000 \
    --session-arg="public_key:public_key='Public Key In Hex'" \
    --session-arg="fee_to_setter:Key='Hash of fee-to-setter Contract'" \
    --session-arg="contract_name:string='contract_name'"

Entry point methods

FACTORY's entry point methods are detailed below:

create_pair

Creates a pair for token_a and token_b if one doesn't exist already.

Note: token_a and token_b are interchangeable and require the user to deploy the pair contract before calling the create pair method so that he can pass the Pair contract hash as a parameter, allowing the Factory contract to call the initialize method of thePair Contract.

Parameters table:

Parameter NameType

token_a

Key

token_b

Key

pair_hash

Key

This method returns nothing.

get_pair

Returns the pair's hash for token0 and token1 if it has been created, else “Hash-0000000000000000000000000000000000000000000000000000000000000000” is returned.

Note: token0 and token1 are interchangeable.

Parameters table:

Parameter NameType

token0

Key

token1

Key

This method returns a Key.

fee_to

Returns the hash of fee_to.

Parameters table:

This method returns a Key.

fee_to_setter

Returns the hash of fee_to_setter.

Parameters table:

This method returns a Key.

all_pairs

Returns a list of all pairs created.

Parameters table:

This method returns a list of Keys.

all_pairs_length

Returns the total number of pairs created through the factory.

Parameters table:

This method returns a U256.

set_fee_to

Sets the hash of fee_to

Note: Only fee_to_setter can set fee_to

Parameters table:

Parameter NameType

fee_to

Key

This method returns nothing.

set_fee_to_setter

Sets the Hash of fee_to_setter

Note: Only fee_to_setter can setfee_to_setter

Parameters table:

Parameter NameType

fee_to_setter

Key

This method returns nothing.

Last updated