🔬
JediSwap
  • 👋Welcome to JediSwap
  • 🛠️Become a contributor
  • 🎁DeFi spring STRK incentives for v2
  • 🎁DeFi Spring STRK incentives for v1
  • FAQ
  • How to use JediSwap
    • How to set up a Starknet wallet
      • How to set up an Argent X wallet
      • How to set up an Argent Web Wallet
      • How to set up a Braavos wallet
    • How to bridge assets to Starknet
      • How to bridge to Starknet using Starkgate
      • How to bridge to Starknet using Orbiter Finance
      • How to bridge to Starknet using LayerSwap
    • How to make a swap
    • How to add liquidity
      • How to add liquidity V1
      • How to add liquidity V2
    • How to ZAP
      • How to ZAP from Ethereum L1 to Starknet
      • How to ZAP on Starknet
    • Points
      • LP Leaderboard
      • Volume Leaderboard
  • For Developers
    • Jediswap v2
      • Core
        • jediswap_v2_factory
        • jediswap_v2_pool
      • Periphery
        • jediswap_v2_nft_position_manager
        • jediswap_v2_swap_router
      • Contract Addresses
      • Deprecated Contract Addresses
    • Jediswap v1
      • Smart Contract integration
        • Implement a swap
        • Providing liquidity
        • Pair Addresses
      • Smart contract reference
        • Router
        • Pair
        • Factory
        • Pair (ERC 20)
  • Risks associated with JediSwap
Powered by GitBook
On this page
  • Code
  • Events
  • Approval​
  • Transfer​
  • View Functions
  • name​
  • symbol​
  • decimals​
  • totalSupply​
  • balanceOf​
  • allowance​
  • State-Changing Functions
  • approve​
  • increaseAllowance​
  • decreaseAllowance​
  • transfer​
  • transferFrom​
  • Interface
  • ABI
  1. For Developers
  2. Jediswap v1
  3. Smart contract reference

Pair (ERC 20)

PreviousFactoryNextRisks associated with JediSwap

Last updated 1 year ago

This documentation covers ERC-20 functionality for denominating pool tokens. For JediSwap-specific functionality, see .

Code

Events

Approval​

@event
func Approval(owner: felt, spender: felt, amount: Uint256):
end

Emitted each time allowances is updated in , , or

Transfer​

@event
func Transfer(from_address: felt, to_address: felt, amount: Uint256):
end

Emitted each time a transfer occurs via , , , or .

View Functions

name​

func name() -> (name: felt):

Returns JediSwap Pair for all pairs.

symbol​

func symbol() -> (symbol: felt):

Returns JEDIP for all pairs.

decimals​

func decimals() -> (decimals: felt):

Returns 18 for all pairs.

totalSupply​

func totalSupply() -> (totalSupply: Uint256):

Returns the total amount of pool tokens for a pair.

balanceOf​

func balanceOf(account: felt) -> (balance: Uint256):

Returns the amount of pool tokens owned by an address.

allowance​

func allowance(owner: felt, spender: felt) -> (remaining: Uint256):

Returns the amount of liquidity tokens owned by an address that a spender is allowed to transfer via transferFrom.

State-Changing Functions

approve​

func approve(spender: felt, amount: Uint256) -> (success: felt):

Lets caller set their allowance for a spender.

increaseAllowance​

func increaseAllowance(spender: felt, added_value: Uint256) -> (success: felt):

Lets caller increase their allowance for a spender by added_value.

decreaseAllowance​

func decreaseAllowance(spender: felt, subtracted_value: Uint256) -> (success: felt):

Lets caller decrease their allowance for a spender by subtracted_value.

transfer​

func transfer(recipient: felt, amount: Uint256) -> (success: felt):

Lets caller send pool tokens to an address.

transferFrom​

func transferFrom(
            sender: felt, 
            recipient: felt, 
            amount: Uint256
        ) -> (success: felt):

Sends pool tokens from one address to another.

  • Requires approval.

Interface

%lang starknet

from starkware.cairo.common.uint256 import Uint256

@contract_interface
namespace IJediSwapPairERC20:
    func name() -> (name: felt):
    end

    func symbol() -> (symbol: felt):
    end

    func decimals() -> (decimals: felt):
    end

    func totalSupply() -> (totalSupply: Uint256):
    end

    func balanceOf(account: felt) -> (balance: Uint256):
    end

    func allowance(owner: felt, spender: felt) -> (remaining: Uint256):
    end

    func transfer(recipient: felt, amount: Uint256) -> (success: felt):
    end

    func transferFrom(
            sender: felt, 
            recipient: felt, 
            amount: Uint256
        ) -> (success: felt):
    end

    func approve(spender: felt, amount: Uint256) -> (success: felt):
    end

    func increaseAllowance(spender: felt, added_value: Uint256) -> (success: felt):
    end

    func decreaseAllowance(spender: felt, subtracted_value: Uint256) -> (success: felt):
    end
end

ABI

Emits .

Emits .

Emits .

Emits .

Emits

See

Approval
Approval
Approval
Transfer
Transfer
Pair
Pair.cairo
approve
increaseAllowance
decreaseAllowance
transferFrom
transfer
transferFrom
mint
burn
Pair ABI