GHO-payment-SDK
π An SDK for building applications on tops of GHO as payment input.
Screenshots





Problem Statement
Github: https://github.com/zhxinyu/gho-payment-sdkThe package GHO-payment-sdk mainly aims to provide GHO token users and holders to make payments activity more easily. GHO is a decentralized multi-collateral stablecoin that is fully backed, transparent and native to the Aave Protocol. Typical payment activity involves transfer and trade. Users can simply call our exported helper functions to perform various transactions using GHO tokens. In particular, the package includes utility functions to transfer, approve, permit, transferFrom and trade.Here some simple snippets to use:getAllowanceGHO(from: string, to: string, provider)approveGHO(signer, amount: string, to: string)permitGHO(signer, amount: string, spender: string)transferGHO(to: string, amount: string, tokenOwner)transferFromGHO(from: string, to: string, amount: string, allowanceOwner: ethers.Signer)getOutputQuote(tokenA: Token, amountIn: string, provider)executeTrade(tradeAccount, signer)Further usage can seenotebook
Solution
The project leverages ethers library to export easy-to-use helper function for GHO tokens payment. All the source codes are located in the src directory.In particular, the tree structure of the project isβββ src β βββ constants β β βββ abi.ts β β βββ abi_json.ts β β βββ address.ts β β βββ index.ts β βββ entities β β βββ index.ts β β βββ tokens.ts β βββ index.ts β βββ trade β β βββ dex β β β βββ uniswap β β β βββ contract-address.ts β β β βββ index.ts β β β βββ pool.ts β β β βββ trade.ts β β βββ index.ts β βββ transfer β β βββ index.ts β β βββ transfer.ts β βββ utils β βββ allowance.ts β βββ assert.ts β βββ conversion.ts β βββ format.ts β βββ index.ts β βββ print.ts β βββ providers.ts βββ tests β βββ index.test.tsTrade Export a trade (buy or sell) helper function for GHO token. At present, we support uniswap DEX.Transfer Export transfer-related helper function for payments via GHO token. In particular, we include transferGHO, transferFromGHO, transfer, transferFrom.Approval Add approve and permit function to increse allowance of GHO token.Utilities Add Token entities to facilitate caching and retrieval of token information such as chainId, address, decimals, symbol, abi and contract instance. In particular,getAllowanceGHO, getAllowanceapproveGHO, approveoff-chain signature preparation: permitGHOassert: throw an error if false statement.print:printBalanceproviders:getJsonRpcProvider,getWallet,sendTransaction,In the end, we also add a demo via a jupyter notebook. pg2.html
Hackathon
LFGHO
2024