Skip to content

feature(pool): add SEP-41 approve()/allowance()/transfer_from() for LP shares #756

Description

@K1NGD4VID

Summary

Full SEP-41 compliance requires the allowance half of the interface (approve/allowance/transfer_from), not just direct transfer — needed for LP shares to compose with contracts that need pre-authorized spending (e.g. a future DEX listing or the LP-governance staking design from round 2's issue #718).

Acceptance Criteria

  • approve(env: Env, from: Address, spender: Address, amount: i128, expiration_ledger: u32) added to contracts/pool/src/lib.rs, storing a new DataKey::Allowance(Address, Address) entry with expiry
  • allowance(env: Env, from: Address, spender: Address) -> i128 added, returning 0 for an expired or unset allowance
  • transfer_from(env: Env, spender: Address, from: Address, to: Address, amount: i128) added, requiring spender.require_auth() and decrementing the stored allowance
  • Test added/updated and passing (cargo test), covering approve → transfer_from → allowance decremented, and transfer_from failing once the allowance is exhausted

Tech Stack

Rust, Soroban SDK, contracts/pool/src/lib.rs, contracts/pool/src/types.rs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions