Factory

Code

Factory.cairo

Address

Factory is deployed at:

Starknet Alpha Testnet: 0x0262744f8cea943dadc8823c318eaf24d0110dee2ee8026298f49a3bc58ed74a

Starknet Alpha Mainnet: 0x00dad44c139a476c7a17fc8141e6db680e9abc9f56fe249a105094c44382c2fd

Events

PairCreated​

@event
func PairCreated(token0: felt, token1: felt, pair: felt, total_pairs: felt):
end

Emitted each time a pair is created via create_pair.

  • The final uint log value will be 1 for the first pair created, 2 for the second, etc.

View Functions

get_pair

Returns the address of the pair for token0 and token1, if it has been created, else address(0).

  • token0 and token1 are interchangeable.

get_all_pairs​

Returns the number of pairs and addresses of all pairs created.

get_num_of_pairs​

Returns the number of pairs created.

get_fee_to​

Get fee recipient address. See Protocol Charge Calculation. TODO

get_fee_to_setter​

The address allowed to change fee_to via set_fee_to.

get_pair_contract_class_hash​

Get the class hash of the Canvas(Pair) contract which is deployed for each create_pair.

State-Changing Functions

create_pair​

Creates a pair for tokenA and tokenB.

  • tokenA and tokenB are interchangeable.

set_fee_to​

Updates fee recipient

  • only fee_to_setter can call.

set_fee_to_setter​

Updates fee to setter

  • only fee_to_setter can call.

  • new_fee_to_setter can not be zero

Interface

ABI

Last updated