orchai-combinator-bsc-simulation
v1.0.51
Published
- [TRAVA SIMULATION ROUTE](#trava-simulation-route) - [Table of contents](#table-of-contents) - [Initialize state](#initialize-state) - [Các action liên quan đến token](#các-action-liên-quan-đến-token) - [Các action liên quan đến pools: deposit, borro
Downloads
30
Readme
orchai-combinator-bsc-simulation
Table of contents
- TRAVA SIMULATION ROUTE
- Table of contents
- Initialize state
- Simulate state
- Simulate Trava Pools actions
- Simulate Trava NFT Marketplace / Sell armoury
- Simulate Trava NFT Marketplace / Auction
- Simulate Trava NFT Utilities
- Simulate Trava Staking
- Simulate Trava Governance State
- Simulate state
import { ApplicationState } from "../State/ApplicationState";
let chainId = Number((await provider.getNetwork()).chainId);
let appState = new ApplicationState(
userAddress: String,
smartWalletAddress: String,
provider: JsonRpcProvider, // reader
chainId: chainId
);
Simulate state
Sau khi init state xong. Với mỗi state, các simulate khác nhau
Simulate Utilities actions
Pull token
result = await simulateSendToken(
appState5,
tokenAddress,
from: wallet address
to: smart wallet address,
amount: number | string
)
Sendtoken
result = await simulateSendToken(
appState6,
tokenAddress,
from: smart wallet address
to: main wallet address,
amount: number | string
)
Wrap
result = await simulateWrap(
appState7,
amount: number | string
)
Unwrap
result = await simulateUnwrap(
appState8,
amount: number | string
)
Simulate Pancake actions
Swap
result = await simulateSwap(
appState9,
fromToken: token 1 address,
toToken: token2 address,
fromAmount: amount of token 1 will swap
fromAddress,
toAddress,
priceImpact
)
Get token balance
balance = await getUserTokenBalance(appState, userAddress, tokenAddress)
Simulate Orai Liquid Staking actions
Stake
result = await simulateOraiLSStake(
appState10,
amount,
from address,
to address
)
Unstake
result = await simulateOraiLSUnstake(
appState12,
_amount,
from address
)
Withdraw Unstake
result = await simulateOraiLSWithdrawUnstake(
appState12,
to address
)
Approve
PullToken
- approve token duoc chon cho smart wallet
Orai LS Stake
- approve Orai cho smart wallet neu from la EOA Wallet
Orai LS Unstake
- approve scOrai cho smart wallet neu from la EOA Wallet
Disploy after action
Wrap and Unwrap
hien thi balance bnb va wbnb
Pull token and send token
hien thi balnace cua token duoc chon
Stake
hien thi balance Orai va ScOrai
Unstake
hien thi balance Orai
Withdraw Unstake
hien thi balance Orai va ScOrai
Swap
hien thi balance cua 2 token swap