This is a program written to ensure safe transfer of SPL Tokens between two parties (Party A & Party B) This is written as a part of the Flaq Program to facilitate user's rewards being sent to them via Flaq transparently
- Init the escrow submitting the following:
- Public Keys of both parties
- Number of Tokens Requested
- Associated Token Acccounts of Party A
- Associated Token Acccount of Party B
- Bump for the PDA created using a the Public Key of a random Keypair
- Fullfill the obligation of each party, with the right amount. And the escrow automatically transfers the right tokens to the right party
- Cancel the escrow if a party requests and refund the tokens
The intention of this program was to use spl-token transfers between PDA's Token Accounts and Associated Token Accounts
Each Escrow Account is a PDA and uses a one time randomly genereated keypair's public key as seed, which needs to be stored by the user to access the escrow account again
2 / 3
- Calculate the space for the accounts whiling init'ing
- Use constraints to validate accounts before transfers
- Move instruction creation on-chain for security purposes