@event
func PairCreated(token0: felt, token1: felt, pair: felt, total_pairs: felt):
end
func get_pair(token0: felt, token1: felt) -> (pair: felt):
Returns the address of the pair for token0 and token1, if it has been created, else address(0).
func get_all_pairs() -> (all_pairs_len: felt, all_pairs: felt*):
Returns the number of pairs and addresses of all pairs created.
func get_num_of_pairs() -> (num_of_pairs: felt):
Returns the number of pairs created.
func get_fee_to() -> (address: felt):
Get fee recipient address. See Protocol Charge Calculation. TODO
func get_fee_to_setter() -> (address: felt):
The address allowed to change fee_to via set_fee_to.
get_pair_contract_class_hash
func get_pair_contract_class_hash() -> (class_hash: felt):
func create_pair(tokenA: felt, tokenB: felt) -> (pair: felt):
Creates a pair for tokenA and tokenB.
func set_fee_to(new_fee_to: felt):
func set_fee_to_setter(new_fee_to_setter: felt):
%lang starknet
@contract_interface
namespace IFactory:
func get_pair(token0: felt, token1: felt) -> (pair: felt):
end
func get_all_pairs() -> (all_pairs_len: felt, all_pairs: felt*):
end
func get_num_of_pairs() -> (num_of_pairs: felt):
end
func get_fee_to() -> (address: felt):
end
func get_fee_to_setter() -> (address: felt):
end
func get_pair_contract_class_hash() -> (class_hash: felt):
end
func create_pair(tokenA: felt, tokenB: felt) -> (pair: felt):
end
func set_fee_to(new_fee_to: felt):
end
func set_fee_to_setter(new_fee_to_setter: felt):
end
end
[
{
"data": [
{
"name": "token0",
"type": "felt"
},
{
"name": "token1",
"type": "felt"
},
{
"name": "pair",
"type": "felt"
},
{
"name": "total_pairs",
"type": "felt"
}
],
"keys": [],
"name": "PairCreated",
"type": "event"
},
{
"inputs": [
{
"name": "pair_contract_class_hash",
"type": "felt"
},
{
"name": "fee_to_setter",
"type": "felt"
}
],
"name": "constructor",
"outputs": [],
"type": "constructor"
},
{
"inputs": [
{
"name": "token0",
"type": "felt"
},
{
"name": "token1",
"type": "felt"
}
],
"name": "get_pair",
"outputs": [
{
"name": "pair",
"type": "felt"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "get_all_pairs",
"outputs": [
{
"name": "all_pairs_len",
"type": "felt"
},
{
"name": "all_pairs",
"type": "felt*"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "get_num_of_pairs",
"outputs": [
{
"name": "num_of_pairs",
"type": "felt"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "get_fee_to",
"outputs": [
{
"name": "address",
"type": "felt"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "get_fee_to_setter",
"outputs": [
{
"name": "address",
"type": "felt"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "get_pair_contract_class_hash",
"outputs": [
{
"name": "class_hash",
"type": "felt"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"name": "tokenA",
"type": "felt"
},
{
"name": "tokenB",
"type": "felt"
}
],
"name": "create_pair",
"outputs": [
{
"name": "pair",
"type": "felt"
}
],
"type": "function"
},
{
"inputs": [
{
"name": "new_fee_to",
"type": "felt"
}
],
"name": "set_fee_to",
"outputs": [],
"type": "function"
},
{
"inputs": [
{
"name": "new_fee_to_setter",
"type": "felt"
}
],
"name": "set_fee_to_setter",
"outputs": [],
"type": "function"
}
]