The CasperSwap Protocol
  • The Casperswap V2 Protocol
    • What’s Casperswap
    • How Casperswap Works
    • Ecosystem Participants
    • Smart contracts
    • Swaps
    • Pools
    • Flash Swaps
    • Oracles
    • Fees
    • Pricing
    • Understanding Returns
  • How to Make a Swap on Casperswap
    • Using Casper Wallet
    • Using Torus Wallet
    • Using MetaMask Wallet
  • How to Provide and Remove Liquidity on Casperswap
    • Providing Liquidity on Casperswap
    • Removing Liquidity on Casperswap
  • How to Bridge to Casper Network
    • Bridging to Casper Network
  • Technical references
    • CasperSwap - Uniswap V2 Core for the Casper Blockchain
      • USAGE
      • ERC-20
      • WCSPR
      • PAIR
      • FACTORY
      • FLASH SWAPPER
    • CasperSwap - Uniswap V2 Router for the Casper Blockchain
      • Usage
  • Tokenomics
Powered by GitBook
On this page
  • Deploying FACTORY contract manually
  • Entry point methods
  • create_pair
  • get_pair
  • fee_to
  • fee_to_setter
  • all_pairs
  • all_pairs_length
  • set_fee_to
  • set_fee_to_setter
  1. Technical references
  2. CasperSwap - Uniswap V2 Core for the Casper Blockchain

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 Name
Type

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 Name
Type

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 Name
Type

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 Name
Type

fee_to_setter

Key

This method returns nothing.

PreviousPAIRNextFLASH SWAPPER

Last updated 3 years ago