Search
Search

Transaction: 8Nidvjx...PM8N

Signed by
Receiver
Status
Succeeded
Transaction Fee
0.0018 
Deposit Value
0.00087 
Gas Used
18 Tgas
Attached Gas
300 Tgas
Created
May 23, 2024 at 8:49:44am
Hash
8NidvjxyfU7hv1cjGEWb3oiQTpMoUb4vSzuAGYhFPM8N

Actions

Called method: 'set' in contract: social.near
Arguments:
{ "data": { "bluebiu.near": { "widget": { "Staking.Kelp.Content": { "": "const StyledContainer = styled.div`\n padding-top: 18px;\n width: 478px;\n border: 1px solid rgba(55, 58, 83, 1);\n border-radius: 16px;\n margin: 50px auto 0;\n padding: 20px 0 0px;\n position: relative;\n`;\nconst Content = styled.div`\n padding: 20px 15px;\n`;\nconst Wrapper = styled.div``;\nconst BlurWrap = styled.div`\n position: relative;\n`;\nconst Blur = styled.div`\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n backdrop-filter: blur(4px);\n`;\nconst Summary = styled.div`\n display: flex;\n padding: 0 20px 20px;\n border-bottom: 1px solid rgba(55, 58, 83, 1);\n align-items: center;\n justify-content: space-between;\n`;\n\nconst SummaryItem = styled.div`\n font-size: 14px;\n font-weight: 400;\n line-height: 16.8px;\n .title {\n color: rgba(151, 154, 190, 1);\n }\n .amount {\n margin-top: 5px;\n color: rgba(255, 255, 255, 1);\n }\n`;\nconst Panel = styled.div`\n height: 100px;\n border-radius: 12px;\n border: 1px solid rgba(55, 58, 83, 1);\n background-color: rgba(46, 49, 66, 1);\n padding: 15px;\n margin-bottom: 20px;\n .title {\n font-size: 14px;\n font-weight: 400;\n line-height: 16.8px;\n color: rgba(151, 154, 190, 1);\n }\n .body {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 20px;\n }\n\n .foot {\n margin-top: 10px;\n display: flex;\n justify-content: center;\n justify-content: space-between;\n font-size: 12px;\n font-weight: 400;\n line-height: 14.4px;\n color: rgba(151, 154, 190, 1);\n }\n`;\nconst Input = styled.input`\n color: #fff;\n font-size: 20px;\n font-weight: 500;\n border: none;\n height: 24px;\n width: 200px;\n outline: none;\n background-color: transparent;\n padding: 0;\n &:focus {\n color: #fff;\n background-color: transparent;\n border-color: transparent;\n outline: none;\n box-shadow: none;\n }\n`;\nconst List = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n font-size: 15px;\n .keys {\n color: rgba(151, 154, 190, 1);\n }\n .values {\n color: #fff;\n }\n`;\n\nconst {\n dexConfig,\n wethAddress,\n multicallAddress,\n chainIdNotSupport,\n multicall,\n prices,\n account,\n addAction,\n toast,\n chainId,\n nativeCurrency,\n tab,\n StakeTokens,\n ExchangeToken,\n} = props;\nconst { parseUnits, formatUnits } = ethers.utils;\nconsole.log(\"Content--\", props);\n\nState.init({\n stakeAmount: \"\",\n curToken: \"\", // token symbol\n exchangeRate: \"\",\n options: [],\n\n tokenBal: 0,\n});\n\nuseEffect(() => {\n State.update({\n loading: !chainIdNotSupport,\n });\n}, []);\n\nuseEffect(() => {\n console.log(\"tab--\", tab);\n const options = StakeTokens?.map((item) => ({\n text: item.symbol,\n value: item.symbol,\n }));\n State.update({\n options,\n curToken: options[0].value,\n });\n}, [tab]);\n\nconst clickBalance = (_bal) => {\n State.update({\n stakeAmount: Big(_bal).toFixed(4, 0),\n });\n};\nfunction getExchangeRate(symbol) {\n const url = `https://universe.kelpdao.xyz/rseth/exchangeRate/?lrtToken=${symbol}`;\n return asyncFetch(url)\n .then((res) => {\n return res.body.value;\n })\n .catch((err) => {\n console.log(\"Catch - getExchangeRate--\", err);\n });\n}\nfunction fetchData(url) {\n return asyncFetch(url);\n}\nfunction getAPY() {\n const url = `https://universe.kelpdao.xyz/rseth/apy`;\n fetchData(url)\n .then((res) => {\n State.update({\n APY: res.body.value || \"-\",\n });\n })\n .catch((err) => {\n console.log(\"Catch-getAPY--\", err);\n });\n}\nfunction getTVL() {\n const url = `https://universe.kelpdao.xyz/rseth/tvl/?lrtToken`;\n fetchData(url)\n .then((res) => {\n State.update({\n TVL: res.body.usdTvl || \"-\",\n });\n })\n .catch((err) => {\n console.log(\"Catch-getTVL--\", err);\n });\n}\n\nuseEffect(() => {\n getAPY();\n getTVL();\n}, []);\n\nuseEffect(() => {\n if (!state.curToken) return;\n\n getExchangeRate(state.curToken).then((_rate) => {\n State.update({\n exchangeRate: _rate,\n });\n });\n\n if (tab === \"Stake\") {\n const _bal = StakeTokens.find(\n (item) => item.symbol === state.curToken\n ).balance;\n\n State.update({\n tokenBal: _bal,\n });\n }\n}, [state.curToken, tab]);\n\n// rsETH balance\nfunction getTokenBalance() {\n const contract = new ethers.Contract(\n ExchangeToken.address,\n [\n {\n inputs: [{ internalType: \"address\", name: \"account\", type: \"address\" }],\n name: \"balanceOf\",\n outputs: [{ internalType: \"uint256\", name: \"value\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n ],\n Ethers.provider().getSigner()\n );\n contract\n .balanceOf(account)\n .then((_balance) => {\n const _bal = formatUnits(_balance, ExchangeToken.decimals);\n console.log(\"get-resETH-balance--\", _balance, balance);\n State.update({\n tokenBal: _bal,\n });\n })\n .catch((err) => {\n console.log(\"Catch-getTokenBalance-error--\", err);\n });\n}\nuseEffect(() => {\n // ethereum unstake\n if (chainId !== 1) return;\n if (tab === \"Unstake\") {\n getTokenBalance();\n\n const options = StakeTokens?.map((item) => ({\n text: item.symbol,\n value: item.symbol,\n })).filter((item) => item.value !== \"ETH\");\n State.update({\n options,\n curToken: options[0].value,\n });\n }\n}, [tab]);\n// console.log(state.curToken, prices[state.curToken]);\n\nreturn (\n <div>\n <StyledContainer>\n <Wrapper>\n <Summary>\n <SummaryItem>\n <div className=\"title\">TVL</div>\n <div className=\"amount\">\n $\n <Widget\n src=\"bluebiu.near/widget/Utils.FormatNumber\"\n props={{\n number: state.TVL,\n }}\n />\n </div>\n </SummaryItem>\n <SummaryItem>\n <div className=\"title\">APY</div>\n <div className=\"amount\">{state.APY}%</div>\n </SummaryItem>\n </Summary>\n {(tab === \"Unstake\" || tab === \"Stake\") && (\n <Content>\n <BlurWrap>\n {chainId !== 1 && (tab === \"Unstake\" || tab === \"Withdraw\") ? (\n <Blur></Blur>\n ) : null}\n\n <Panel>\n <div className=\"title\">\n {tab === \"Unstake\" ? \"Withdraw rsETH as\" : tab}\n </div>\n <div className=\"body\">\n <Input\n type=\"text\"\n placeholder=\"0\"\n value={state.stakeAmount}\n onChange={(ev) => {\n if (isNaN(Number(ev.target.value))) return;\n let amount = ev.target.value.replace(/\\s+/g, \"\");\n\n if (Big(amount || 0).gt(Big(state.tokenBal || 0))) {\n amount = Big(state.tokenBal || 0).toFixed(4, 0);\n }\n State.update({\n stakeAmount: amount,\n });\n }}\n />\n <Widget\n src=\"bluebiu.near/widget/UI.Select.Index\"\n props={{\n options: state.options,\n value: state.options.find(\n (obj) => obj.value === state.curToken\n ),\n onChange: (option) => {\n console.log(\"onchange--\", option);\n State.update({\n curToken: option.value,\n });\n },\n }}\n />\n </div>\n <div className=\"foot\">\n <div class=\"prices\">\n $\n {Big(state.stakeAmount || 0)\n .times(Big(prices[state.curToken] || 1))\n .toFixed(2, 0)}\n </div>\n <div class=\"balance\">\n Balance:\n <Widget\n src=\"bluebiu.near/widget/Staking.Kelp.Balance\"\n props={{\n value: state.tokenBal,\n digit: 4,\n onClick: clickBalance,\n symbol:\n tab === \"Stake\"\n ? state.curToken\n : ExchangeToken.symbol,\n }}\n />\n </div>\n </div>\n </Panel>\n <List>\n <span className=\"keys\">You will get</span>\n <span className=\"values\">\n {Big(state.stakeAmount || 0)\n .div(state.exchangeRate || 1)\n .toFixed(4, 0)}{\" \"}\n {tab === \"Stake\" ? ExchangeToken.symbol : state.curToken}\n </span>\n </List>\n <List>\n <span className=\"keys\">Exchange rate</span>\n <span className=\"values\">\n 1 {ExchangeToken?.symbol} ={\" \"}\n {Big(state.exchangeRate || 0).toFixed(4, 0)}{\" \"}\n {tab === \"Stake\" ? ExchangeToken.symbol : state.curToken}\n </span>\n </List>\n </BlurWrap>\n <Widget\n src=\"bluebiu.near/widget/Staking.Kelp.Button\"\n props={{\n ...props,\n actionText: tab,\n amount: state.stakeAmount,\n curToken: state.curToken,\n stakeToken: StakeTokens\n ? StakeTokens.find((item) => item.symbol === state.curToken)\n : {},\n onSuccess: () => {\n State.update({ loading: true, stakeAmount: \"\" });\n },\n }}\n />\n </Content>\n )}\n {tab === \"Withdraw\" && <div>null</div>}\n </Wrapper>\n\n {/* {state.loading && <Widget src=\"bluebiu.near/widget/Lending.Spinner\" />} */}\n </StyledContainer>\n\n {/* <Widget\n src={dexConfig.data}\n props={{\n ...props,\n update: state.loading,\n onLoad: (data) => {\n console.log(\"onLoad--\", data);\n State.update({\n loading: false,\n timestamp: Date.now(),\n ...data,\n });\n },\n }}\n /> */}\n </div>\n);\n" }, "ZKEVM-all-in-one": { "": "const Layout = styled.div``;\n\nconst Container = styled.div`\n width: 100%;\n min-height: 100vh;\n display: flex;\n justify-content: center;\n\n .flex-grow {\n flex-grow: 1;\n }\n .contentOut {\n /* padding-top: 25px;\n margin-left: 35px; */\n }\n .contentOut p {\n font-size: 20px;\n font-weight: 700;\n margin-bottom: 20px;\n color: #ffffff;\n }\n @media (max-width: 900px) {\n display: grid;\n .contentOut {\n padding: 0;\n margin: 0 0 36px 0;\n }\n .contentOut p {\n display: none;\n }\n }\n`;\n\nconst MenuContainer = styled.div`\n margin-right: 35px;\n .item {\n display: flex;\n align-items: center;\n padding-left: 40px;\n width: 180px;\n height: 64px;\n font-weight: 500;\n font-size: 16px;\n color: #7e8a93;\n cursor: pointer;\n margin-bottom: 2px;\n border-right: \"none\";\n transition: 0.5s;\n border-radius: 16px;\n :hover {\n background: linear-gradient(270deg, #373a53 0%, rgba(55, 58, 83, 0) 100%);\n color: #ffffff;\n }\n }\n .item.active {\n color: #ffffff;\n background: linear-gradient(270deg, #373a53 0%, rgba(55, 58, 83, 0) 100%);\n }\n .item.disable {\n cursor: not-allowed;\n }\n .icon {\n width: 26px;\n }\n @media (max-width: 900px) {\n margin: 0;\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n grid-gap: 16px;\n background: #222436;\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 1;\n padding: 0 16px;\n .item {\n width: auto;\n padding: 0;\n height: 76px;\n display: grid;\n text-align: center;\n align-items: center;\n span {\n margin-left: 26px;\n margin-bottom: -28px;\n }\n }\n .item.active {\n background-image: none;\n color: #e9f456;\n border-color: transparent;\n }\n }\n`;\n\nconst activeMenu =\n Storage.privateGet(\"zkevmCachedActiveMenu\") || props.defaultTab || \"Bridge\";\n\nfunction changeTab(menu) {\n Storage.privateSet(\"zkevmCachedActiveMenu\", menu);\n}\n\n// svg icon start\nconst headIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"18\"\n height=\"16\"\n viewBox=\"0 0 18 16\"\n fill=\"none\"\n >\n <path\n d=\"M17 9C17.5523 9 18 8.55228 18 8C18 7.44772 17.5523 7 17 7V9ZM0.292892 7.29289C-0.0976315 7.68342 -0.0976315 8.31658 0.292892 8.70711L6.65685 15.0711C7.04738 15.4616 7.68054 15.4616 8.07107 15.0711C8.46159 14.6805 8.46159 14.0474 8.07107 13.6569L2.41421 8L8.07107 2.34315C8.46159 1.95262 8.46159 1.31946 8.07107 0.928932C7.68054 0.538408 7.04738 0.538408 6.65685 0.928932L0.292892 7.29289ZM17 7L1 7V9L17 9V7Z\"\n fill=\"#979ABE\"\n />\n </svg>\n);\n\nconst bridgeIcon = (\n <svg\n width=\"19\"\n height=\"18\"\n viewBox=\"0 0 19 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <mask\n id=\"mask0_1328_7364\"\n maskUnits=\"userSpaceOnUse\"\n x=\"0\"\n y=\"0\"\n width=\"18\"\n height=\"18\"\n >\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M17.7684 3.3323C16.5569 2.49226 15.0859 2 13.5 2C9.35786 2 6 5.35786 6 9.5C6 13.6421 9.35786 17 13.5 17C13.9539 17 14.3984 16.9597 14.8302 16.8824C13.3983 17.5946 11.7518 18 10 18C4.47715 18 0 13.9706 0 9C0 4.02944 4.47715 0 10 0C13.1361 0 15.935 1.29925 17.7684 3.3323Z\"\n fill=\"currentColor\"\n />\n </mask>\n <g mask=\"url(#mask0_1328_7364)\">\n <rect width=\"19\" height=\"11\" fill=\"currentColor\" />\n </g>\n <mask\n id=\"mask1_1328_7364\"\n maskUnits=\"userSpaceOnUse\"\n x=\"8\"\n y=\"4\"\n width=\"11\"\n height=\"13\"\n >\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M8.99975 5.42751C9.28439 5.37792 9.5772 5.35206 9.87604 5.35206C12.6763 5.35206 14.9463 7.62209 14.9463 10.4223C14.9463 13.1425 12.8042 15.3623 10.1149 15.487C10.9532 15.9225 11.9057 16.1686 12.9157 16.1686C16.276 16.1686 19 13.4446 19 10.0843C19 6.72403 16.276 4 12.9157 4C11.4242 4 10.058 4.5367 8.99975 5.42751Z\"\n fill=\"currentColor\"\n />\n </mask>\n <g mask=\"url(#mask1_1328_7364)\">\n <rect\n width=\"9.99974\"\n height=\"6.66649\"\n transform=\"matrix(-1 0 0 1 19 4)\"\n fill=\"currentColor\"\n />\n </g>\n </svg>\n);\n\nconst swapIcon = (\n <svg\n width=\"16\"\n height=\"14\"\n viewBox=\"0 0 16 14\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M11.2571 7.76056C11.1005 7.61142 10.8919 7.52941 10.6756 7.53205C10.4594 7.53468 10.2527 7.62176 10.0998 7.77467C9.94692 7.92758 9.85984 8.13422 9.85721 8.35045C9.85457 8.56669 9.93658 8.77539 10.0857 8.93199L10.7343 9.58056H4.41429C3.68252 9.5798 2.98095 9.28877 2.46351 8.77134C1.94607 8.2539 1.65505 7.55232 1.65429 6.82056C1.65416 6.18756 1.83563 5.56781 2.17715 5.03484C2.29574 4.85033 2.33617 4.62626 2.28955 4.41193C2.24294 4.19761 2.11309 4.01058 1.92858 3.89199C1.74406 3.7734 1.51999 3.73296 1.30567 3.77958C1.09134 3.82619 0.904308 3.95604 0.785718 4.14056C0.271637 4.93979 -0.00115865 5.87027 3.69903e-06 6.82056C0.00151569 7.99083 0.467076 9.11275 1.29459 9.94026C2.1221 10.7678 3.24401 11.2333 4.41429 11.2348H10.6486L10.0771 11.8063C9.93601 11.9643 9.86075 12.1703 9.86684 12.3821C9.87293 12.5939 9.95991 12.7953 10.1099 12.9449C10.2599 13.0945 10.4615 13.181 10.6733 13.1866C10.8851 13.1921 11.0909 13.1164 11.2486 12.9748L13.2657 10.9577C13.3425 10.881 13.4034 10.7899 13.445 10.6897C13.4866 10.5894 13.508 10.4819 13.508 10.3734C13.508 10.2649 13.4866 10.1574 13.445 10.0572C13.4034 9.9569 13.3425 9.86582 13.2657 9.78913L11.2571 7.76056Z\"\n fill=\"currentColor\"\n />\n <path\n d=\"M11.5857 2.132H4.80001L5.55144 1.38057C5.69258 1.22258 5.76784 1.01652 5.76175 0.804751C5.75566 0.592982 5.66868 0.39159 5.51869 0.241968C5.3687 0.0923464 5.1671 0.00586073 4.95532 0.000287087C4.74354 -0.00528655 4.53766 0.0704751 4.38001 0.212001L2.36287 2.22914C2.28607 2.30583 2.22514 2.39691 2.18357 2.49717C2.142 2.59743 2.12061 2.7049 2.12061 2.81343C2.12061 2.92196 2.142 3.02943 2.18357 3.12969C2.22514 3.22995 2.28607 3.32102 2.36287 3.39771L4.38001 5.41486C4.53766 5.55638 4.74354 5.63214 4.95532 5.62657C5.1671 5.621 5.3687 5.53451 5.51869 5.38489C5.66868 5.23527 5.75566 5.03388 5.76175 4.82211C5.76784 4.61034 5.69258 4.40428 5.55144 4.24629L5.09144 3.78629H11.5857C12.3175 3.78704 13.0191 4.07807 13.5365 4.59551C14.0539 5.11294 14.345 5.81452 14.3457 6.54629C14.3463 7.19597 14.1544 7.83126 13.7943 8.372C13.6748 8.5549 13.6323 8.77761 13.6762 8.99165C13.7201 9.20569 13.8467 9.39374 14.0286 9.51486C14.1644 9.60396 14.3233 9.65161 14.4857 9.652C14.6223 9.6521 14.7568 9.6182 14.877 9.55336C14.9972 9.48851 15.0994 9.39477 15.1743 9.28057C15.7132 8.47055 16.0005 7.51921 16 6.54629C15.9985 5.37601 15.5329 4.2541 14.7054 3.42658C13.8779 2.59907 12.756 2.13351 11.5857 2.132Z\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nconst liquidityIcon = (\n <svg\n width=\"20\"\n height=\"18\"\n viewBox=\"0 0 20 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M3.67689 9.5C3.42392 8.81656 3.28571 8.07718 3.28571 7.30542C3.28571 3.82303 6.09992 1 9.57142 1C13.0429 1 15.8571 3.82303 15.8571 7.30542C15.8571 8.93781 15.2388 10.4253 14.2242 11.5451\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n <path\n d=\"M1 10.5189C8.5 6.99986 11 14 18.1429 10.5189M1 15.5C8.5 11.9809 11 18.9811 18.1429 15.5\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n </svg>\n);\nconst lendingIcon = (\n <svg\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 18 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M4.30875 5.99853C4.30742 5.41955 4.42014 4.84597 4.64048 4.31055C4.86082 3.77513 5.18445 3.28836 5.59292 2.87801C6.00138 2.46767 6.48666 2.1418 7.02107 1.91901C7.55547 1.69621 8.12852 1.58086 8.7075 1.57953C11.1375 1.57953 13.1062 3.5584 13.1062 5.99853C13.1071 6.78301 12.8991 7.55358 12.5037 8.23111C12.1083 8.90865 11.5397 9.46875 10.8562 9.8539C10.6313 10.5014 10.2105 11.0629 9.65211 11.4604C9.09372 11.8579 8.42545 12.0718 7.74 12.0724H5.5665V10.5267H7.74225C8.71425 10.5267 9.50175 9.73578 9.50175 8.75928V8.64903H3.22763L3.20288 14.7668H12.9893C13.9601 14.7668 14.7488 13.9748 14.7488 12.9994L14.7724 10.8574H12.3165V9.31165H16.3125L16.2878 12.9994C16.2892 13.876 15.9427 14.7174 15.3242 15.3386C14.7057 15.9599 13.8659 16.3101 12.9893 16.3125H1.66275L1.6875 7.10215H4.44713C4.35496 6.74153 4.30847 6.37075 4.30875 5.99853ZM6.06713 7.10215H11.0396V7.65903C11.3715 7.1899 11.5673 6.61728 11.5673 5.99853C11.5681 5.62215 11.4949 5.24928 11.3516 4.90122C11.2084 4.55317 10.9979 4.23674 10.7324 3.97003C10.4668 3.70331 10.1513 3.49153 9.80386 3.34678C9.45643 3.20202 9.08388 3.12714 8.7075 3.1264C8.33112 3.12714 7.95857 3.20202 7.61114 3.34678C7.2637 3.49153 6.94819 3.70331 6.68262 3.97003C6.41705 4.23674 6.20664 4.55317 6.06339 4.90122C5.92014 5.24928 5.84686 5.62215 5.84775 5.99853C5.84775 6.3889 5.9265 6.76353 6.06713 7.10215Z\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nconst { swapConfig, ...restProps } = props;\n\nreturn (\n <Layout>\n <Container>\n <MenuContainer>\n <div\n onClick={() => {\n changeTab(\"Bridge\");\n }}\n className={`item ${activeMenu == \"Bridge\" ? \"active\" : \"\"}`}\n >\n <span className=\"icon\">{bridgeIcon}</span>\n Bridge\n </div>\n <div\n onClick={() => {\n changeTab(\"swap\");\n }}\n className={`item ${activeMenu == \"swap\" ? \"active\" : \"\"}`}\n >\n <span className=\"icon\">{swapIcon}</span>\n Swap\n </div>\n\n <div\n className={`item ${activeMenu == \"Liquidity\" ? \"active\" : \"\"}`}\n onClick={() => {\n changeTab(\"Liquidity\");\n }}\n >\n <span className=\"icon\">{liquidityIcon}</span>\n Liquidity\n </div>\n </MenuContainer>\n <div className=\"flex-grow contentOut\">\n {activeMenu == \"Bridge\" ? (\n <>\n <Widget\n src=\"guessme.near/widget/ZKEVMSwap.zkevm-bridge\"\n props={{\n layout: \"center\",\n ...restProps,\n }}\n />\n </>\n ) : null}\n {activeMenu == \"swap\" ? (\n <>\n <Widget\n src=\"bluebiu.near/widget/PolygonZkevm.Swap.Dex\"\n props={{\n layout: \"center\",\n ...swapConfig,\n ...restProps,\n }}\n />\n </>\n ) : null}\n {activeMenu == \"Liquidity\" ? (\n <>\n <Widget\n src=\"bluebiu.near/widget/ZKEVM.GAMMA\"\n props={{ ...restProps }}\n />\n </>\n ) : null}\n </div>\n </Container>\n </Layout>\n);\n", "metadata": { "image": { "ipfs_cid": "bafkreiaednvljfk5splm5p3eisbkr3v5laiazldxqirtxs5koimckebsyu" }, "name": "Polygon zkEVM All-in-one", "tags": { "dexes": "" } } }, "Lending.Liquity.MarketButton": { "": "const ERC20_ABI = [\n {\n constant: true,\n inputs: [\n {\n name: \"_owner\",\n type: \"address\",\n },\n {\n name: \"_spender\",\n type: \"address\",\n },\n ],\n name: \"allowance\",\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n },\n ],\n payable: false,\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n constant: false,\n inputs: [\n {\n name: \"_spender\",\n type: \"address\",\n },\n {\n name: \"_value\",\n type: \"uint256\",\n },\n ],\n name: \"approve\",\n outputs: [\n {\n name: \"\",\n type: \"bool\",\n },\n ],\n payable: false,\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n];\nconst Button = styled.button`\n background-color: var(--switch-color);\n height: 46px;\n line-height: 46px;\n border-radius: 10px;\n color: var(--button-text-color);\n font-size: 18px;\n font-weight: 500;\n border: none;\n width: 100%;\n transition: 0.5s;\n &:hover {\n opacity: 0.8;\n }\n &:disabled {\n opacity: 0.5;\n }\n &.borrow {\n background-color: var(--repay-border-color);\n border: 1px solid var(--repay-border-color);\n }\n &.repay {\n background-color: var(--repay-bg-hover-color);\n border: 1px solid var(--repay-border-color);\n }\n &.close {\n width: 408px;\n background-color: var(--repay-border-color);\n border: 1px solid var(--repay-border-color);\n }\n`;\n\nconst {\n actionText,\n data,\n chainId,\n onSuccess,\n toast,\n addAction,\n unsignedTx,\n loading: estimating,\n gas,\n _assetAmount,\n _debtTokenAmount,\n onApprovedSuccess,\n\n isDebtBigerThanBalance,\n collateralRatio,\n yourLTV,\n IS_ETHOS_DAPP,\n IS_PREON_DAPP,\n IS_GRAVITA_DAPP,\n IS_LYVE_DAPP,\n _maxFeePercentage,\n GAS_LIMIT_RECOMMENDATIONS,\n isCloseDisabled,\n} = props;\n\nconst account = Ethers.send(\"eth_requestAccounts\", [])[0];\n\nconst tokenSymbol = data.underlyingToken.symbol;\nif (!actionText) return;\n\nuseEffect(() => {\n State.update({\n approving: false,\n isApproved: false,\n isGasEnough: true,\n });\n}, []);\n\nuseEffect(() => {\n if (!account || !gas) return;\n const provider = Ethers.provider();\n provider.getBalance(account).then((rawBalance) => {\n State.update({\n gasBalance: rawBalance.toString(),\n isGasEnough: !Big(rawBalance.toString()).lt(gas.toString()),\n gas: ethers.utils.formatUnits(gas, 18),\n });\n });\n}, [account, gas]);\n\nfunction makeCloseContract() {\n if (IS_PREON_DAPP || IS_GRAVITA_DAPP || IS_LYVE_DAPP) {\n const contract = new ethers.Contract(\n data.config.BorrowerOperations,\n [\n {\n inputs: [\n { internalType: \"address\", name: \"_asset\", type: \"address\" },\n ],\n name: \"closeVessel\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n ],\n Ethers.provider().getSigner()\n );\n\n return contract.closeVessel(data.underlyingToken.address, {\n gasLimit: 700000,\n });\n }\n\n if (IS_ETHOS_DAPP) {\n const contract = new ethers.Contract(\n data.config.BorrowerOperations,\n [\n {\n inputs: [\n { internalType: \"address\", name: \"_collateral\", type: \"address\" },\n ],\n name: \"closeTrove\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n ],\n Ethers.provider().getSigner()\n );\n\n return contract.closeTrove(data.underlyingToken.address, {\n gasLimit: 4000000,\n });\n }\n}\n\nfunction handleClose() {\n State.update({\n pending: true,\n });\n\n makeCloseContract()\n .then((tx) => {\n tx.wait()\n .then((res) => {\n const { status, transactionHash } = res;\n toast?.dismiss(toastId);\n State.update({\n pending: false,\n });\n\n if (status === 1) {\n onSuccess?.(data.dapp);\n toast?.success({\n title: `${tokenSymbol} ${actionText.toLowerCase()} request successed!`,\n tx: transactionHash,\n chainId,\n });\n } else {\n toast?.fail({\n title: `${tokenSymbol} ${actionText.toLowerCase()} request failed!`,\n tx: transactionHash,\n chainId,\n });\n }\n })\n .catch((err) => {\n State.update({\n pending: false,\n });\n });\n })\n .catch((err) => {\n console.log(\"closeVessel_error:\", err);\n State.update({\n pending: false,\n });\n\n toast?.dismiss(toastId);\n toast?.fail({\n title: err?.message?.includes(\"user rejected transaction\")\n ? \"User rejected transaction\"\n : `${tokenSymbol} ${actionText.toLowerCase()} request failed!`,\n tx: err ? err.hash : \"\",\n chainId,\n });\n });\n}\n\nif (actionText === \"Close\") {\n return (\n <Button\n onClick={handleClose}\n disabled={state.pending || isCloseDisabled}\n className={actionText.toLowerCase()}\n >\n {state.pending ? (\n <Widget\n src=\"bluebiu.near/widget/0vix.LendingLoadingIcon\"\n props={{\n size: 16,\n }}\n />\n ) : (\n \"Close\"\n )}\n </Button>\n );\n}\n\nif (!_assetAmount) {\n return (\n <Button disabled={true} className={actionText.toLowerCase()}>\n Enter An Amount\n </Button>\n );\n}\n\nif (IS_GRAVITA_DAPP && IS_PREON_DAPP && IS_LYVE_DAPP) {\n if (isDebtBigerThanBalance) {\n return (\n <Button disabled={true} className={actionText.toLowerCase()}>\n Insufficient Balance\n </Button>\n );\n }\n if (Big(yourLTV).gt(Big(data.MAX_LTV).mul(100))) {\n return (\n <Button disabled={true} className={actionText.toLowerCase()}>\n LTV must be below {Big(data.MAX_LTV).mul(100).toFixed(2)}%\n </Button>\n );\n }\n}\nif (IS_ETHOS_DAPP) {\n if (\n Big(collateralRatio || 0)\n .mul(100)\n .lt(Big(data.MCR).mul(100))\n ) {\n return (\n <Button disabled={true} className={actionText.toLowerCase()}>\n {`Collateral Ratio must above the MCR of ${Big(data.MCR).mul(100)}%`}\n </Button>\n );\n }\n}\n\nif (Big(_debtTokenAmount || 0).lt(data[\"MIN_DEBT\"])) {\n return (\n <Button disabled={true} className={actionText.toLowerCase()}>\n A minimum of {data[\"MIN_DEBT\"]} {data.BORROW_TOKEN}\n </Button>\n );\n}\n\nconst tokenAddr = data.underlyingToken.address;\nconst spender = data.config.BorrowerOperations;\n\nconsole.log(\"APPROVE: \", tokenAddr, spender, props);\n\nconst getAllowance = () => {\n const TokenContract = new ethers.Contract(\n tokenAddr,\n ERC20_ABI,\n Ethers.provider().getSigner()\n );\n TokenContract.allowance(account, spender).then((allowanceRaw) => {\n console.log(\"ALLOWANCE:\", allowanceRaw.toString());\n State.update({\n isApproved: !Big(\n ethers.utils.formatUnits(\n allowanceRaw._hex,\n data.underlyingToken.decimals\n )\n ).lt(_assetAmount || \"0\"),\n });\n });\n};\n\nif ([\"Borrow\"].includes(actionText)) {\n getAllowance();\n}\n\nif (!state.isApproved) {\n const handleApprove = () => {\n const toastId = toast?.loading({\n title: `Approve ${Big(_assetAmount).toFixed(2)} ${tokenSymbol}`,\n });\n State.update({\n approving: true,\n });\n\n const TokenContract = new ethers.Contract(\n tokenAddr,\n ERC20_ABI,\n Ethers.provider().getSigner()\n );\n TokenContract.approve(\n spender,\n ethers.utils.parseUnits(_assetAmount, data.underlyingToken.decimals)\n )\n .then((tx) => {\n tx.wait()\n .then((res) => {\n const { status, transactionHash } = res;\n toast?.dismiss(toastId);\n if (status !== 1) throw new Error(\"\");\n State.update({\n isApproved: true,\n approving: false,\n });\n toast?.success({\n title: \"Approve Successfully!\",\n text: `Approve ${Big(_assetAmount).toFixed(2)} ${tokenSymbol}`,\n tx: transactionHash,\n chainId,\n });\n onApprovedSuccess();\n })\n .catch((err) => {\n State.update({\n isApproved: false,\n approving: false,\n });\n });\n })\n .catch((err) => {\n State.update({\n isApproved: false,\n approving: false,\n });\n toast?.dismiss(toastId);\n toast?.fail({\n title: \"Approve Failed!\",\n text: err?.message?.includes(\"user rejected transaction\")\n ? \"User rejected transaction\"\n : `Approve ${Big(_assetAmount).toFixed(2)} ${tokenSymbol}`,\n });\n onLoad?.(false);\n });\n };\n return (\n <Button onClick={handleApprove} disabled={state.approving}>\n {state.approving ? (\n <Widget\n src=\"bluebiu.near/widget/0vix.LendingLoadingIcon\"\n props={{\n size: 16,\n }}\n />\n ) : (\n \"Approve\"\n )}\n </Button>\n );\n}\n\nfunction makeOpenContract() {\n if (IS_PREON_DAPP || IS_GRAVITA_DAPP || IS_LYVE_DAPP) {\n const _asset = data.underlyingToken.address;\n const _assetAmount = ethers.utils.parseUnits(\n _assetAmount,\n data.underlyingToken.decimals\n );\n const _debtTokenAmount = ethers.utils.parseUnits(\n _debtTokenAmount,\n data.decimals\n );\n const _upperHint = \"0x544f96434f77437425d5aC40fd4755C0cf39399A\";\n const _lowerHint = \"0xA1B7bbade134DB3B14B56056480e81c60Ab77377\";\n const params = [\n _asset,\n _assetAmount,\n _debtTokenAmount,\n _upperHint,\n _lowerHint,\n ];\n const contract = new ethers.Contract(\n data.config.BorrowerOperations,\n [\n {\n inputs: [\n { internalType: \"address\", name: \"_asset\", type: \"address\" },\n { internalType: \"uint256\", name: \"_assetAmount\", type: \"uint256\" },\n {\n internalType: \"uint256\",\n name: \"_debtTokenAmount\",\n type: \"uint256\",\n },\n { internalType: \"address\", name: \"_upperHint\", type: \"address\" },\n { internalType: \"address\", name: \"_lowerHint\", type: \"address\" },\n ],\n name: \"openVessel\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n ],\n Ethers.provider().getSigner()\n );\n\n return contract.openVessel(...params, {\n gasLimit: GAS_LIMIT_RECOMMENDATIONS[\"borrow\"].limit,\n });\n }\n\n if (IS_ETHOS_DAPP) {\n const _collateral = data.underlyingToken.address;\n const _collAmount = ethers.utils.parseUnits(\n _assetAmount,\n data.underlyingToken.decimals\n );\n const _LUSDAmount = ethers.utils.parseUnits(\n _debtTokenAmount,\n data.decimals\n );\n const _upperHint = \"0xc655B790FF812109c8F6c3f24fd20b3495164A51\";\n const _lowerHint = \"0x0000000000000000000000000000000000000000\";\n const params = [\n _collateral,\n _collAmount,\n _maxFeePercentage,\n _LUSDAmount,\n _upperHint,\n _lowerHint,\n ];\n\n const contract = new ethers.Contract(\n data.config.BorrowerOperations,\n [\n {\n inputs: [\n { internalType: \"address\", name: \"_collateral\", type: \"address\" },\n { internalType: \"uint256\", name: \"_collAmount\", type: \"uint256\" },\n {\n internalType: \"uint256\",\n name: \"_maxFeePercentage\",\n type: \"uint256\",\n },\n { internalType: \"uint256\", name: \"_LUSDAmount\", type: \"uint256\" },\n { internalType: \"address\", name: \"_upperHint\", type: \"address\" },\n { internalType: \"address\", name: \"_lowerHint\", type: \"address\" },\n ],\n name: \"openTrove\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n ],\n Ethers.provider().getSigner()\n );\n\n return contract.openTrove(...params, {\n gasLimit: 4000000,\n });\n }\n}\n\nfunction handleBorrow() {\n State.update({\n pending: true,\n });\n\n makeOpenContract()\n .then((tx) => {\n tx.wait()\n .then((res) => {\n const { status, transactionHash } = res;\n toast?.dismiss(toastId);\n State.update({\n pending: false,\n });\n addAction?.({\n type: \"Lending\",\n action: actionText,\n token: data.underlyingToken,\n amount: _assetAmount,\n template: data.config.name,\n add: false,\n status,\n transactionHash,\n });\n if (status === 1) {\n onSuccess?.(data.dapp);\n toast?.success({\n title: `${tokenSymbol} ${actionText.toLowerCase()} request successed!`,\n tx: transactionHash,\n chainId,\n });\n } else {\n toast?.fail({\n title: `${tokenSymbol} ${actionText.toLowerCase()} request failed!`,\n tx: transactionHash,\n chainId,\n });\n }\n })\n .catch((err) => {\n State.update({\n pending: false,\n });\n });\n })\n .catch((err) => {\n console.log(\"openVessel_error:\", err);\n State.update({\n pending: false,\n });\n\n toast?.dismiss(toastId);\n toast?.fail({\n title: err?.message?.includes(\"user rejected transaction\")\n ? \"User rejected transaction\"\n : `${tokenSymbol} ${actionText.toLowerCase()} request failed!`,\n tx: err ? err.hash : \"\",\n chainId,\n });\n });\n}\n\nreturn (\n <>\n <Button\n disabled={state.pending || estimating || !state.isGasEnough}\n className={actionText.toLowerCase()}\n onClick={handleBorrow}\n >\n {state.pending || estimating ? (\n <Widget\n src=\"bluebiu.near/widget/0vix.LendingLoadingIcon\"\n props={{\n size: 16,\n }}\n />\n ) : !state.isGasEnough ? (\n `Not enough gas(${Big(state.gas || 0).toFixed(2)}) needed`\n ) : (\n actionText\n )}\n </Button>\n </>\n);\n" }, "Lending.Liquity.PoolButton": { "": "const ERC20_ABI = [\n {\n constant: true,\n inputs: [\n {\n name: \"_owner\",\n type: \"address\",\n },\n {\n name: \"_spender\",\n type: \"address\",\n },\n ],\n name: \"allowance\",\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n },\n ],\n payable: false,\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n constant: false,\n inputs: [\n {\n name: \"_spender\",\n type: \"address\",\n },\n {\n name: \"_value\",\n type: \"uint256\",\n },\n ],\n name: \"approve\",\n outputs: [\n {\n name: \"\",\n type: \"bool\",\n },\n ],\n payable: false,\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n];\nconst Button = styled.button`\n background-color: var(--switch-color);\n line-height: 46px;\n height: 46px;\n border-radius: 10px;\n color: var(--button-text-color);\n font-size: 18px;\n font-weight: 500;\n border: none;\n width: 100%;\n transition: 0.5s;\n &:hover {\n opacity: 0.8;\n }\n &:disabled {\n opacity: 0.5;\n }\n &.borrow {\n background-color: var(--repay-border-color);\n border: 1px solid var(--repay-border-color);\n }\n &.repay {\n background-color: var(--repay-bg-hover-color);\n border: 1px solid var(--repay-border-color);\n }\n &.close {\n width: 408px;\n background-color: var(--repay-border-color);\n border: 1px solid var(--repay-border-color);\n }\n`;\n\nconst {\n actionText,\n amount,\n data,\n chainId,\n onSuccess,\n toast,\n addAction,\n loading: estimating,\n gas,\n onApprovedSuccess,\n isBigerThanBalance,\n IS_ETHOS_DAPP,\n IS_PREON_DAPP,\n IS_GRAVITA_DAPP,\n IS_LYVE_DAPP,\n} = props;\n\n// for Yours\nconst account = Ethers.send(\"eth_requestAccounts\", [])[0];\n\nconst tokenSymbol = data.underlyingToken.symbol;\nif (!actionText) return;\n\nuseEffect(() => {\n State.update({\n approving: false,\n isApproved: true,\n isGasEnough: true,\n });\n}, []);\n\nuseEffect(() => {\n if (!account || !gas) return;\n const provider = Ethers.provider();\n provider.getBalance(account).then((rawBalance) => {\n State.update({\n gasBalance: rawBalance.toString(),\n isGasEnough: !Big(rawBalance.toString()).lt(gas.toString()),\n gas: ethers.utils.formatUnits(gas, 18),\n });\n });\n}, [account, gas]);\n\nif (!amount) {\n return (\n <Button disabled={true} className={actionText.toLowerCase()}>\n Enter An Amount\n </Button>\n );\n}\n\nif (isBigerThanBalance) {\n return (\n <Button disabled={true} className={actionText.toLowerCase()}>\n Insufficient Balance\n </Button>\n );\n}\n\nconst tokenAddr = data.config.borrowTokenAddress;\nlet spender;\nif (IS_ETHOS_DAPP || IS_PREON_DAPP || IS_GRAVITA_DAPP) {\n spender = data.config.BorrowerOperations;\n}\nif (IS_LYVE_DAPP) {\n spender = data.config.StabilityPool;\n}\n\nconsole.log(\"APPROVE: \", tokenAddr, spender, props);\n\nconst getAllowance = () => {\n const TokenContract = new ethers.Contract(\n tokenAddr,\n ERC20_ABI,\n Ethers.provider().getSigner()\n );\n TokenContract.allowance(account, spender).then((allowanceRaw) => {\n console.log(\"ALLOWANCE:\", allowanceRaw.toString());\n State.update({\n isApproved: !Big(\n ethers.utils.formatUnits(\n allowanceRaw._hex,\n data.underlyingToken.decimals\n )\n ).lt(amount || \"0\"),\n });\n });\n};\n\nif ([\"Deposit\"].includes(actionText)) {\n getAllowance();\n}\n\nif (!state.isApproved) {\n const handleApprove = () => {\n const toastId = toast?.loading({\n title: `Approve ${Big(amount).toFixed(2)} ${tokenSymbol}`,\n });\n State.update({\n approving: true,\n });\n\n const TokenContract = new ethers.Contract(\n tokenAddr,\n ERC20_ABI,\n Ethers.provider().getSigner()\n );\n TokenContract.approve(\n spender,\n ethers.utils.parseUnits(amount, data.underlyingToken.decimals)\n )\n .then((tx) => {\n tx.wait()\n .then((res) => {\n const { status, transactionHash } = res;\n toast?.dismiss(toastId);\n if (status !== 1) throw new Error(\"\");\n State.update({\n isApproved: true,\n approving: false,\n });\n toast?.success({\n title: \"Approve Successfully!\",\n text: `Approve ${Big(amount).toFixed(2)} ${tokenSymbol}`,\n tx: transactionHash,\n chainId,\n });\n onApprovedSuccess();\n })\n .catch((err) => {\n State.update({\n isApproved: false,\n approving: false,\n });\n });\n })\n .catch((err) => {\n State.update({\n isApproved: false,\n approving: false,\n });\n toast?.dismiss(toastId);\n toast?.fail({\n title: \"Approve Failed!\",\n text: err?.message?.includes(\"user rejected transaction\")\n ? \"User rejected transaction\"\n : `Approve ${Big(amount).toFixed(2)} ${tokenSymbol}`,\n });\n onLoad?.(false);\n });\n };\n return (\n <Button onClick={handleApprove} disabled={state.approving}>\n {state.approving ? (\n <Widget\n src=\"bluebiu.near/widget/0vix.LendingLoadingIcon\"\n props={{\n size: 16,\n }}\n />\n ) : (\n \"Approve\"\n )}\n </Button>\n );\n}\n\nfunction handleClick() {\n State.update({\n pending: true,\n });\n console.log(\"click:\", actionText, data);\n let abi;\n if (data.BORROW_TOKEN === \"GRAI\" || data.BORROW_TOKEN === \"LYU\") {\n abi = [\n {\n inputs: [\n { internalType: \"uint256\", name: \"_amount\", type: \"uint256\" },\n { internalType: \"address[]\", name: \"_assets\", type: \"address[]\" },\n ],\n name: \"provideToSP\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"uint256\", name: \"_amount\", type: \"uint256\" },\n { internalType: \"address[]\", name: \"_assets\", type: \"address[]\" },\n ],\n name: \"withdrawFromSP\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n ];\n }\n if (data.BORROW_TOKEN === \"STAR\" || data.BORROW_TOKEN === \"ERN\") {\n abi = [\n {\n inputs: [{ internalType: \"uint256\", name: \"_amount\", type: \"uint256\" }],\n name: \"provideToSP\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"uint256\", name: \"_amount\", type: \"uint256\" }],\n name: \"withdrawFromSP\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n ];\n }\n const contract = new ethers.Contract(\n data.config.StabilityPool,\n abi,\n Ethers.provider().getSigner()\n );\n\n const tokenArray = Object.keys(data.config.markets);\n\n const _amount = ethers.utils.parseUnits(amount);\n let params = {};\n if (data.BORROW_TOKEN === \"GRAI\") {\n params = [_amount, tokenArray];\n }\n if (data.BORROW_TOKEN === \"LYU\") {\n params = [_amount, [\"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f\"]];\n }\n\n if (data.BORROW_TOKEN === \"STAR\" || data.BORROW_TOKEN === \"ERN\") {\n params = [_amount];\n }\n console.log(\"dw_params:\", params);\n if (actionText === \"Deposit\") {\n contract\n .provideToSP(...params, {\n gasLimit: 700000,\n })\n .then((tx) => {\n tx.wait()\n .then((res) => {\n const { status, transactionHash } = res;\n toast?.dismiss(toastId);\n State.update({\n pending: false,\n });\n // addAction?.({\n // type: \"Lending\",\n // action: actionText,\n // token: data.underlyingToken,\n // amount,\n // template: data.config.name,\n // add: false,\n // status,\n // transactionHash,\n // });\n if (status === 1) {\n onSuccess?.(data.dapp);\n toast?.success({\n title: `${tokenSymbol} ${actionText.toLowerCase()} request successed!`,\n tx: transactionHash,\n chainId,\n });\n } else {\n toast?.fail({\n title: `${tokenSymbol} ${actionText.toLowerCase()} request failed!`,\n tx: transactionHash,\n chainId,\n });\n }\n })\n .catch((err) => {\n State.update({\n pending: false,\n });\n });\n })\n .catch((err) => {\n State.update({\n pending: false,\n });\n\n toast?.dismiss(toastId);\n toast?.fail({\n title: err?.message?.includes(\"user rejected transaction\")\n ? \"User rejected transaction\"\n : `${tokenSymbol} ${actionText.toLowerCase()} request failed!`,\n tx: err ? err.hash : \"\",\n chainId,\n });\n });\n }\n if (actionText === \"Withdraw\") {\n contract\n .withdrawFromSP(...params, {\n gasLimit: 700000,\n })\n .then((tx) => {\n tx.wait()\n .then((res) => {\n const { status, transactionHash } = res;\n toast?.dismiss(toastId);\n State.update({\n pending: false,\n });\n // addAction?.({\n // type: \"Lending\",\n // action: actionText,\n // token: data.underlyingToken,\n // amount,\n // template: data.config.name,\n // add: false,\n // status,\n // transactionHash,\n // });\n if (status === 1) {\n onSuccess?.(data.dapp);\n toast?.success({\n title: `${tokenSymbol} ${actionText.toLowerCase()} request successed!`,\n tx: transactionHash,\n chainId,\n });\n } else {\n toast?.fail({\n title: `${tokenSymbol} ${actionText.toLowerCase()} request failed!`,\n tx: transactionHash,\n chainId,\n });\n }\n })\n .catch((err) => {\n State.update({\n pending: false,\n });\n });\n })\n .catch((err) => {\n State.update({\n pending: false,\n });\n\n toast?.dismiss(toastId);\n toast?.fail({\n title: err?.message?.includes(\"user rejected transaction\")\n ? \"User rejected transaction\"\n : `${tokenSymbol} ${actionText.toLowerCase()} request failed!`,\n tx: err ? err.hash : \"\",\n chainId,\n });\n });\n }\n}\n\nreturn (\n <>\n <Button\n disabled={state.pending}\n className={actionText.toLowerCase()}\n onClick={handleClick}\n >\n {state.pending ? (\n <Widget\n src=\"bluebiu.near/widget/0vix.LendingLoadingIcon\"\n props={{\n size: 16,\n }}\n />\n ) : (\n actionText\n )}\n </Button>\n </>\n);\n" } } } } }

Transaction Execution Plan

Convert Transaction To Receipt
Gas Burned:
417 Ggas
Tokens Burned:
0.00004 
Receipt:
Predecessor ID:
Receiver ID:
Gas Burned:
17 Tgas
Tokens Burned:
0.00175 
Called method: 'set' in contract: social.near
Arguments:
{ "data": { "bluebiu.near": { "widget": { "Staking.Kelp.Content": { "": "const StyledContainer = styled.div`\n padding-top: 18px;\n width: 478px;\n border: 1px solid rgba(55, 58, 83, 1);\n border-radius: 16px;\n margin: 50px auto 0;\n padding: 20px 0 0px;\n position: relative;\n`;\nconst Content = styled.div`\n padding: 20px 15px;\n`;\nconst Wrapper = styled.div``;\nconst BlurWrap = styled.div`\n position: relative;\n`;\nconst Blur = styled.div`\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n backdrop-filter: blur(4px);\n`;\nconst Summary = styled.div`\n display: flex;\n padding: 0 20px 20px;\n border-bottom: 1px solid rgba(55, 58, 83, 1);\n align-items: center;\n justify-content: space-between;\n`;\n\nconst SummaryItem = styled.div`\n font-size: 14px;\n font-weight: 400;\n line-height: 16.8px;\n .title {\n color: rgba(151, 154, 190, 1);\n }\n .amount {\n margin-top: 5px;\n color: rgba(255, 255, 255, 1);\n }\n`;\nconst Panel = styled.div`\n height: 100px;\n border-radius: 12px;\n border: 1px solid rgba(55, 58, 83, 1);\n background-color: rgba(46, 49, 66, 1);\n padding: 15px;\n margin-bottom: 20px;\n .title {\n font-size: 14px;\n font-weight: 400;\n line-height: 16.8px;\n color: rgba(151, 154, 190, 1);\n }\n .body {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 20px;\n }\n\n .foot {\n margin-top: 10px;\n display: flex;\n justify-content: center;\n justify-content: space-between;\n font-size: 12px;\n font-weight: 400;\n line-height: 14.4px;\n color: rgba(151, 154, 190, 1);\n }\n`;\nconst Input = styled.input`\n color: #fff;\n font-size: 20px;\n font-weight: 500;\n border: none;\n height: 24px;\n width: 200px;\n outline: none;\n background-color: transparent;\n padding: 0;\n &:focus {\n color: #fff;\n background-color: transparent;\n border-color: transparent;\n outline: none;\n box-shadow: none;\n }\n`;\nconst List = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n font-size: 15px;\n .keys {\n color: rgba(151, 154, 190, 1);\n }\n .values {\n color: #fff;\n }\n`;\n\nconst {\n dexConfig,\n wethAddress,\n multicallAddress,\n chainIdNotSupport,\n multicall,\n prices,\n account,\n addAction,\n toast,\n chainId,\n nativeCurrency,\n tab,\n StakeTokens,\n ExchangeToken,\n} = props;\nconst { parseUnits, formatUnits } = ethers.utils;\nconsole.log(\"Content--\", props);\n\nState.init({\n stakeAmount: \"\",\n curToken: \"\", // token symbol\n exchangeRate: \"\",\n options: [],\n\n tokenBal: 0,\n});\n\nuseEffect(() => {\n State.update({\n loading: !chainIdNotSupport,\n });\n}, []);\n\nuseEffect(() => {\n console.log(\"tab--\", tab);\n const options = StakeTokens?.map((item) => ({\n text: item.symbol,\n value: item.symbol,\n }));\n State.update({\n options,\n curToken: options[0].value,\n });\n}, [tab]);\n\nconst clickBalance = (_bal) => {\n State.update({\n stakeAmount: Big(_bal).toFixed(4, 0),\n });\n};\nfunction getExchangeRate(symbol) {\n const url = `https://universe.kelpdao.xyz/rseth/exchangeRate/?lrtToken=${symbol}`;\n return asyncFetch(url)\n .then((res) => {\n return res.body.value;\n })\n .catch((err) => {\n console.log(\"Catch - getExchangeRate--\", err);\n });\n}\nfunction fetchData(url) {\n return asyncFetch(url);\n}\nfunction getAPY() {\n const url = `https://universe.kelpdao.xyz/rseth/apy`;\n fetchData(url)\n .then((res) => {\n State.update({\n APY: res.body.value || \"-\",\n });\n })\n .catch((err) => {\n console.log(\"Catch-getAPY--\", err);\n });\n}\nfunction getTVL() {\n const url = `https://universe.kelpdao.xyz/rseth/tvl/?lrtToken`;\n fetchData(url)\n .then((res) => {\n State.update({\n TVL: res.body.usdTvl || \"-\",\n });\n })\n .catch((err) => {\n console.log(\"Catch-getTVL--\", err);\n });\n}\n\nuseEffect(() => {\n getAPY();\n getTVL();\n}, []);\n\nuseEffect(() => {\n if (!state.curToken) return;\n\n getExchangeRate(state.curToken).then((_rate) => {\n State.update({\n exchangeRate: _rate,\n });\n });\n\n if (tab === \"Stake\") {\n const _bal = StakeTokens.find(\n (item) => item.symbol === state.curToken\n ).balance;\n\n State.update({\n tokenBal: _bal,\n });\n }\n}, [state.curToken, tab]);\n\n// rsETH balance\nfunction getTokenBalance() {\n const contract = new ethers.Contract(\n ExchangeToken.address,\n [\n {\n inputs: [{ internalType: \"address\", name: \"account\", type: \"address\" }],\n name: \"balanceOf\",\n outputs: [{ internalType: \"uint256\", name: \"value\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n ],\n Ethers.provider().getSigner()\n );\n contract\n .balanceOf(account)\n .then((_balance) => {\n const _bal = formatUnits(_balance, ExchangeToken.decimals);\n console.log(\"get-resETH-balance--\", _balance, balance);\n State.update({\n tokenBal: _bal,\n });\n })\n .catch((err) => {\n console.log(\"Catch-getTokenBalance-error--\", err);\n });\n}\nuseEffect(() => {\n // ethereum unstake\n if (chainId !== 1) return;\n if (tab === \"Unstake\") {\n getTokenBalance();\n\n const options = StakeTokens?.map((item) => ({\n text: item.symbol,\n value: item.symbol,\n })).filter((item) => item.value !== \"ETH\");\n State.update({\n options,\n curToken: options[0].value,\n });\n }\n}, [tab]);\n// console.log(state.curToken, prices[state.curToken]);\n\nreturn (\n <div>\n <StyledContainer>\n <Wrapper>\n <Summary>\n <SummaryItem>\n <div className=\"title\">TVL</div>\n <div className=\"amount\">\n $\n <Widget\n src=\"bluebiu.near/widget/Utils.FormatNumber\"\n props={{\n number: state.TVL,\n }}\n />\n </div>\n </SummaryItem>\n <SummaryItem>\n <div className=\"title\">APY</div>\n <div className=\"amount\">{state.APY}%</div>\n </SummaryItem>\n </Summary>\n {(tab === \"Unstake\" || tab === \"Stake\") && (\n <Content>\n <BlurWrap>\n {chainId !== 1 && (tab === \"Unstake\" || tab === \"Withdraw\") ? (\n <Blur></Blur>\n ) : null}\n\n <Panel>\n <div className=\"title\">\n {tab === \"Unstake\" ? \"Withdraw rsETH as\" : tab}\n </div>\n <div className=\"body\">\n <Input\n type=\"text\"\n placeholder=\"0\"\n value={state.stakeAmount}\n onChange={(ev) => {\n if (isNaN(Number(ev.target.value))) return;\n let amount = ev.target.value.replace(/\\s+/g, \"\");\n\n if (Big(amount || 0).gt(Big(state.tokenBal || 0))) {\n amount = Big(state.tokenBal || 0).toFixed(4, 0);\n }\n State.update({\n stakeAmount: amount,\n });\n }}\n />\n <Widget\n src=\"bluebiu.near/widget/UI.Select.Index\"\n props={{\n options: state.options,\n value: state.options.find(\n (obj) => obj.value === state.curToken\n ),\n onChange: (option) => {\n console.log(\"onchange--\", option);\n State.update({\n curToken: option.value,\n });\n },\n }}\n />\n </div>\n <div className=\"foot\">\n <div class=\"prices\">\n $\n {Big(state.stakeAmount || 0)\n .times(Big(prices[state.curToken] || 1))\n .toFixed(2, 0)}\n </div>\n <div class=\"balance\">\n Balance:\n <Widget\n src=\"bluebiu.near/widget/Staking.Kelp.Balance\"\n props={{\n value: state.tokenBal,\n digit: 4,\n onClick: clickBalance,\n symbol:\n tab === \"Stake\"\n ? state.curToken\n : ExchangeToken.symbol,\n }}\n />\n </div>\n </div>\n </Panel>\n <List>\n <span className=\"keys\">You will get</span>\n <span className=\"values\">\n {Big(state.stakeAmount || 0)\n .div(state.exchangeRate || 1)\n .toFixed(4, 0)}{\" \"}\n {tab === \"Stake\" ? ExchangeToken.symbol : state.curToken}\n </span>\n </List>\n <List>\n <span className=\"keys\">Exchange rate</span>\n <span className=\"values\">\n 1 {ExchangeToken?.symbol} ={\" \"}\n {Big(state.exchangeRate || 0).toFixed(4, 0)}{\" \"}\n {tab === \"Stake\" ? ExchangeToken.symbol : state.curToken}\n </span>\n </List>\n </BlurWrap>\n <Widget\n src=\"bluebiu.near/widget/Staking.Kelp.Button\"\n props={{\n ...props,\n actionText: tab,\n amount: state.stakeAmount,\n curToken: state.curToken,\n stakeToken: StakeTokens\n ? StakeTokens.find((item) => item.symbol === state.curToken)\n : {},\n onSuccess: () => {\n State.update({ loading: true, stakeAmount: \"\" });\n },\n }}\n />\n </Content>\n )}\n {tab === \"Withdraw\" && <div>null</div>}\n </Wrapper>\n\n {/* {state.loading && <Widget src=\"bluebiu.near/widget/Lending.Spinner\" />} */}\n </StyledContainer>\n\n {/* <Widget\n src={dexConfig.data}\n props={{\n ...props,\n update: state.loading,\n onLoad: (data) => {\n console.log(\"onLoad--\", data);\n State.update({\n loading: false,\n timestamp: Date.now(),\n ...data,\n });\n },\n }}\n /> */}\n </div>\n);\n" }, "ZKEVM-all-in-one": { "": "const Layout = styled.div``;\n\nconst Container = styled.div`\n width: 100%;\n min-height: 100vh;\n display: flex;\n justify-content: center;\n\n .flex-grow {\n flex-grow: 1;\n }\n .contentOut {\n /* padding-top: 25px;\n margin-left: 35px; */\n }\n .contentOut p {\n font-size: 20px;\n font-weight: 700;\n margin-bottom: 20px;\n color: #ffffff;\n }\n @media (max-width: 900px) {\n display: grid;\n .contentOut {\n padding: 0;\n margin: 0 0 36px 0;\n }\n .contentOut p {\n display: none;\n }\n }\n`;\n\nconst MenuContainer = styled.div`\n margin-right: 35px;\n .item {\n display: flex;\n align-items: center;\n padding-left: 40px;\n width: 180px;\n height: 64px;\n font-weight: 500;\n font-size: 16px;\n color: #7e8a93;\n cursor: pointer;\n margin-bottom: 2px;\n border-right: \"none\";\n transition: 0.5s;\n border-radius: 16px;\n :hover {\n background: linear-gradient(270deg, #373a53 0%, rgba(55, 58, 83, 0) 100%);\n color: #ffffff;\n }\n }\n .item.active {\n color: #ffffff;\n background: linear-gradient(270deg, #373a53 0%, rgba(55, 58, 83, 0) 100%);\n }\n .item.disable {\n cursor: not-allowed;\n }\n .icon {\n width: 26px;\n }\n @media (max-width: 900px) {\n margin: 0;\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n grid-gap: 16px;\n background: #222436;\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 1;\n padding: 0 16px;\n .item {\n width: auto;\n padding: 0;\n height: 76px;\n display: grid;\n text-align: center;\n align-items: center;\n span {\n margin-left: 26px;\n margin-bottom: -28px;\n }\n }\n .item.active {\n background-image: none;\n color: #e9f456;\n border-color: transparent;\n }\n }\n`;\n\nconst activeMenu =\n Storage.privateGet(\"zkevmCachedActiveMenu\") || props.defaultTab || \"Bridge\";\n\nfunction changeTab(menu) {\n Storage.privateSet(\"zkevmCachedActiveMenu\", menu);\n}\n\n// svg icon start\nconst headIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"18\"\n height=\"16\"\n viewBox=\"0 0 18 16\"\n fill=\"none\"\n >\n <path\n d=\"M17 9C17.5523 9 18 8.55228 18 8C18 7.44772 17.5523 7 17 7V9ZM0.292892 7.29289C-0.0976315 7.68342 -0.0976315 8.31658 0.292892 8.70711L6.65685 15.0711C7.04738 15.4616 7.68054 15.4616 8.07107 15.0711C8.46159 14.6805 8.46159 14.0474 8.07107 13.6569L2.41421 8L8.07107 2.34315C8.46159 1.95262 8.46159 1.31946 8.07107 0.928932C7.68054 0.538408 7.04738 0.538408 6.65685 0.928932L0.292892 7.29289ZM17 7L1 7V9L17 9V7Z\"\n fill=\"#979ABE\"\n />\n </svg>\n);\n\nconst bridgeIcon = (\n <svg\n width=\"19\"\n height=\"18\"\n viewBox=\"0 0 19 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <mask\n id=\"mask0_1328_7364\"\n maskUnits=\"userSpaceOnUse\"\n x=\"0\"\n y=\"0\"\n width=\"18\"\n height=\"18\"\n >\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M17.7684 3.3323C16.5569 2.49226 15.0859 2 13.5 2C9.35786 2 6 5.35786 6 9.5C6 13.6421 9.35786 17 13.5 17C13.9539 17 14.3984 16.9597 14.8302 16.8824C13.3983 17.5946 11.7518 18 10 18C4.47715 18 0 13.9706 0 9C0 4.02944 4.47715 0 10 0C13.1361 0 15.935 1.29925 17.7684 3.3323Z\"\n fill=\"currentColor\"\n />\n </mask>\n <g mask=\"url(#mask0_1328_7364)\">\n <rect width=\"19\" height=\"11\" fill=\"currentColor\" />\n </g>\n <mask\n id=\"mask1_1328_7364\"\n maskUnits=\"userSpaceOnUse\"\n x=\"8\"\n y=\"4\"\n width=\"11\"\n height=\"13\"\n >\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M8.99975 5.42751C9.28439 5.37792 9.5772 5.35206 9.87604 5.35206C12.6763 5.35206 14.9463 7.62209 14.9463 10.4223C14.9463 13.1425 12.8042 15.3623 10.1149 15.487C10.9532 15.9225 11.9057 16.1686 12.9157 16.1686C16.276 16.1686 19 13.4446 19 10.0843C19 6.72403 16.276 4 12.9157 4C11.4242 4 10.058 4.5367 8.99975 5.42751Z\"\n fill=\"currentColor\"\n />\n </mask>\n <g mask=\"url(#mask1_1328_7364)\">\n <rect\n width=\"9.99974\"\n height=\"6.66649\"\n transform=\"matrix(-1 0 0 1 19 4)\"\n fill=\"currentColor\"\n />\n </g>\n </svg>\n);\n\nconst swapIcon = (\n <svg\n width=\"16\"\n height=\"14\"\n viewBox=\"0 0 16 14\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M11.2571 7.76056C11.1005 7.61142 10.8919 7.52941 10.6756 7.53205C10.4594 7.53468 10.2527 7.62176 10.0998 7.77467C9.94692 7.92758 9.85984 8.13422 9.85721 8.35045C9.85457 8.56669 9.93658 8.77539 10.0857 8.93199L10.7343 9.58056H4.41429C3.68252 9.5798 2.98095 9.28877 2.46351 8.77134C1.94607 8.2539 1.65505 7.55232 1.65429 6.82056C1.65416 6.18756 1.83563 5.56781 2.17715 5.03484C2.29574 4.85033 2.33617 4.62626 2.28955 4.41193C2.24294 4.19761 2.11309 4.01058 1.92858 3.89199C1.74406 3.7734 1.51999 3.73296 1.30567 3.77958C1.09134 3.82619 0.904308 3.95604 0.785718 4.14056C0.271637 4.93979 -0.00115865 5.87027 3.69903e-06 6.82056C0.00151569 7.99083 0.467076 9.11275 1.29459 9.94026C2.1221 10.7678 3.24401 11.2333 4.41429 11.2348H10.6486L10.0771 11.8063C9.93601 11.9643 9.86075 12.1703 9.86684 12.3821C9.87293 12.5939 9.95991 12.7953 10.1099 12.9449C10.2599 13.0945 10.4615 13.181 10.6733 13.1866C10.8851 13.1921 11.0909 13.1164 11.2486 12.9748L13.2657 10.9577C13.3425 10.881 13.4034 10.7899 13.445 10.6897C13.4866 10.5894 13.508 10.4819 13.508 10.3734C13.508 10.2649 13.4866 10.1574 13.445 10.0572C13.4034 9.9569 13.3425 9.86582 13.2657 9.78913L11.2571 7.76056Z\"\n fill=\"currentColor\"\n />\n <path\n d=\"M11.5857 2.132H4.80001L5.55144 1.38057C5.69258 1.22258 5.76784 1.01652 5.76175 0.804751C5.75566 0.592982 5.66868 0.39159 5.51869 0.241968C5.3687 0.0923464 5.1671 0.00586073 4.95532 0.000287087C4.74354 -0.00528655 4.53766 0.0704751 4.38001 0.212001L2.36287 2.22914C2.28607 2.30583 2.22514 2.39691 2.18357 2.49717C2.142 2.59743 2.12061 2.7049 2.12061 2.81343C2.12061 2.92196 2.142 3.02943 2.18357 3.12969C2.22514 3.22995 2.28607 3.32102 2.36287 3.39771L4.38001 5.41486C4.53766 5.55638 4.74354 5.63214 4.95532 5.62657C5.1671 5.621 5.3687 5.53451 5.51869 5.38489C5.66868 5.23527 5.75566 5.03388 5.76175 4.82211C5.76784 4.61034 5.69258 4.40428 5.55144 4.24629L5.09144 3.78629H11.5857C12.3175 3.78704 13.0191 4.07807 13.5365 4.59551C14.0539 5.11294 14.345 5.81452 14.3457 6.54629C14.3463 7.19597 14.1544 7.83126 13.7943 8.372C13.6748 8.5549 13.6323 8.77761 13.6762 8.99165C13.7201 9.20569 13.8467 9.39374 14.0286 9.51486C14.1644 9.60396 14.3233 9.65161 14.4857 9.652C14.6223 9.6521 14.7568 9.6182 14.877 9.55336C14.9972 9.48851 15.0994 9.39477 15.1743 9.28057C15.7132 8.47055 16.0005 7.51921 16 6.54629C15.9985 5.37601 15.5329 4.2541 14.7054 3.42658C13.8779 2.59907 12.756 2.13351 11.5857 2.132Z\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nconst liquidityIcon = (\n <svg\n width=\"20\"\n height=\"18\"\n viewBox=\"0 0 20 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M3.67689 9.5C3.42392 8.81656 3.28571 8.07718 3.28571 7.30542C3.28571 3.82303 6.09992 1 9.57142 1C13.0429 1 15.8571 3.82303 15.8571 7.30542C15.8571 8.93781 15.2388 10.4253 14.2242 11.5451\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n <path\n d=\"M1 10.5189C8.5 6.99986 11 14 18.1429 10.5189M1 15.5C8.5 11.9809 11 18.9811 18.1429 15.5\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n </svg>\n);\nconst lendingIcon = (\n <svg\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 18 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M4.30875 5.99853C4.30742 5.41955 4.42014 4.84597 4.64048 4.31055C4.86082 3.77513 5.18445 3.28836 5.59292 2.87801C6.00138 2.46767 6.48666 2.1418 7.02107 1.91901C7.55547 1.69621 8.12852 1.58086 8.7075 1.57953C11.1375 1.57953 13.1062 3.5584 13.1062 5.99853C13.1071 6.78301 12.8991 7.55358 12.5037 8.23111C12.1083 8.90865 11.5397 9.46875 10.8562 9.8539C10.6313 10.5014 10.2105 11.0629 9.65211 11.4604C9.09372 11.8579 8.42545 12.0718 7.74 12.0724H5.5665V10.5267H7.74225C8.71425 10.5267 9.50175 9.73578 9.50175 8.75928V8.64903H3.22763L3.20288 14.7668H12.9893C13.9601 14.7668 14.7488 13.9748 14.7488 12.9994L14.7724 10.8574H12.3165V9.31165H16.3125L16.2878 12.9994C16.2892 13.876 15.9427 14.7174 15.3242 15.3386C14.7057 15.9599 13.8659 16.3101 12.9893 16.3125H1.66275L1.6875 7.10215H4.44713C4.35496 6.74153 4.30847 6.37075 4.30875 5.99853ZM6.06713 7.10215H11.0396V7.65903C11.3715 7.1899 11.5673 6.61728 11.5673 5.99853C11.5681 5.62215 11.4949 5.24928 11.3516 4.90122C11.2084 4.55317 10.9979 4.23674 10.7324 3.97003C10.4668 3.70331 10.1513 3.49153 9.80386 3.34678C9.45643 3.20202 9.08388 3.12714 8.7075 3.1264C8.33112 3.12714 7.95857 3.20202 7.61114 3.34678C7.2637 3.49153 6.94819 3.70331 6.68262 3.97003C6.41705 4.23674 6.20664 4.55317 6.06339 4.90122C5.92014 5.24928 5.84686 5.62215 5.84775 5.99853C5.84775 6.3889 5.9265 6.76353 6.06713 7.10215Z\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nconst { swapConfig, ...restProps } = props;\n\nreturn (\n <Layout>\n <Container>\n <MenuContainer>\n <div\n onClick={() => {\n changeTab(\"Bridge\");\n }}\n className={`item ${activeMenu == \"Bridge\" ? \"active\" : \"\"}`}\n >\n <span className=\"icon\">{bridgeIcon}</span>\n Bridge\n </div>\n <div\n onClick={() => {\n changeTab(\"swap\");\n }}\n className={`item ${activeMenu == \"swap\" ? \"active\" : \"\"}`}\n >\n <span className=\"icon\">{swapIcon}</span>\n Swap\n </div>\n\n <div\n className={`item ${activeMenu == \"Liquidity\" ? \"active\" : \"\"}`}\n onClick={() => {\n changeTab(\"Liquidity\");\n }}\n >\n <span className=\"icon\">{liquidityIcon}</span>\n Liquidity\n </div>\n </MenuContainer>\n <div className=\"flex-grow contentOut\">\n {activeMenu == \"Bridge\" ? (\n <>\n <Widget\n src=\"guessme.near/widget/ZKEVMSwap.zkevm-bridge\"\n props={{\n layout: \"center\",\n ...restProps,\n }}\n />\n </>\n ) : null}\n {activeMenu == \"swap\" ? (\n <>\n <Widget\n src=\"bluebiu.near/widget/PolygonZkevm.Swap.Dex\"\n props={{\n layout: \"center\",\n ...swapConfig,\n ...restProps,\n }}\n />\n </>\n ) : null}\n {activeMenu == \"Liquidity\" ? (\n <>\n <Widget\n src=\"bluebiu.near/widget/ZKEVM.GAMMA\"\n props={{ ...restProps }}\n />\n </>\n ) : null}\n </div>\n </Container>\n </Layout>\n);\n", "metadata": { "image": { "ipfs_cid": "bafkreiaednvljfk5splm5p3eisbkr3v5laiazldxqirtxs5koimckebsyu" }, "name": "Polygon zkEVM All-in-one", "tags": { "dexes": "" } } }, "Lending.Liquity.MarketButton": { "": "const ERC20_ABI = [\n {\n constant: true,\n inputs: [\n {\n name: \"_owner\",\n type: \"address\",\n },\n {\n name: \"_spender\",\n type: \"address\",\n },\n ],\n name: \"allowance\",\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n },\n ],\n payable: false,\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n constant: false,\n inputs: [\n {\n name: \"_spender\",\n type: \"address\",\n },\n {\n name: \"_value\",\n type: \"uint256\",\n },\n ],\n name: \"approve\",\n outputs: [\n {\n name: \"\",\n type: \"bool\",\n },\n ],\n payable: false,\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n];\nconst Button = styled.button`\n background-color: var(--switch-color);\n height: 46px;\n line-height: 46px;\n border-radius: 10px;\n color: var(--button-text-color);\n font-size: 18px;\n font-weight: 500;\n border: none;\n width: 100%;\n transition: 0.5s;\n &:hover {\n opacity: 0.8;\n }\n &:disabled {\n opacity: 0.5;\n }\n &.borrow {\n background-color: var(--repay-border-color);\n border: 1px solid var(--repay-border-color);\n }\n &.repay {\n background-color: var(--repay-bg-hover-color);\n border: 1px solid var(--repay-border-color);\n }\n &.close {\n width: 408px;\n background-color: var(--repay-border-color);\n border: 1px solid var(--repay-border-color);\n }\n`;\n\nconst {\n actionText,\n data,\n chainId,\n onSuccess,\n toast,\n addAction,\n unsignedTx,\n loading: estimating,\n gas,\n _assetAmount,\n _debtTokenAmount,\n onApprovedSuccess,\n\n isDebtBigerThanBalance,\n collateralRatio,\n yourLTV,\n IS_ETHOS_DAPP,\n IS_PREON_DAPP,\n IS_GRAVITA_DAPP,\n IS_LYVE_DAPP,\n _maxFeePercentage,\n GAS_LIMIT_RECOMMENDATIONS,\n isCloseDisabled,\n} = props;\n\nconst account = Ethers.send(\"eth_requestAccounts\", [])[0];\n\nconst tokenSymbol = data.underlyingToken.symbol;\nif (!actionText) return;\n\nuseEffect(() => {\n State.update({\n approving: false,\n isApproved: false,\n isGasEnough: true,\n });\n}, []);\n\nuseEffect(() => {\n if (!account || !gas) return;\n const provider = Ethers.provider();\n provider.getBalance(account).then((rawBalance) => {\n State.update({\n gasBalance: rawBalance.toString(),\n isGasEnough: !Big(rawBalance.toString()).lt(gas.toString()),\n gas: ethers.utils.formatUnits(gas, 18),\n });\n });\n}, [account, gas]);\n\nfunction makeCloseContract() {\n if (IS_PREON_DAPP || IS_GRAVITA_DAPP || IS_LYVE_DAPP) {\n const contract = new ethers.Contract(\n data.config.BorrowerOperations,\n [\n {\n inputs: [\n { internalType: \"address\", name: \"_asset\", type: \"address\" },\n ],\n name: \"closeVessel\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n ],\n Ethers.provider().getSigner()\n );\n\n return contract.closeVessel(data.underlyingToken.address, {\n gasLimit: 700000,\n });\n }\n\n if (IS_ETHOS_DAPP) {\n const contract = new ethers.Contract(\n data.config.BorrowerOperations,\n [\n {\n inputs: [\n { internalType: \"address\", name: \"_collateral\", type: \"address\" },\n ],\n name: \"closeTrove\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n ],\n Ethers.provider().getSigner()\n );\n\n return contract.closeTrove(data.underlyingToken.address, {\n gasLimit: 4000000,\n });\n }\n}\n\nfunction handleClose() {\n State.update({\n pending: true,\n });\n\n makeCloseContract()\n .then((tx) => {\n tx.wait()\n .then((res) => {\n const { status, transactionHash } = res;\n toast?.dismiss(toastId);\n State.update({\n pending: false,\n });\n\n if (status === 1) {\n onSuccess?.(data.dapp);\n toast?.success({\n title: `${tokenSymbol} ${actionText.toLowerCase()} request successed!`,\n tx: transactionHash,\n chainId,\n });\n } else {\n toast?.fail({\n title: `${tokenSymbol} ${actionText.toLowerCase()} request failed!`,\n tx: transactionHash,\n chainId,\n });\n }\n })\n .catch((err) => {\n State.update({\n pending: false,\n });\n });\n })\n .catch((err) => {\n console.log(\"closeVessel_error:\", err);\n State.update({\n pending: false,\n });\n\n toast?.dismiss(toastId);\n toast?.fail({\n title: err?.message?.includes(\"user rejected transaction\")\n ? \"User rejected transaction\"\n : `${tokenSymbol} ${actionText.toLowerCase()} request failed!`,\n tx: err ? err.hash : \"\",\n chainId,\n });\n });\n}\n\nif (actionText === \"Close\") {\n return (\n <Button\n onClick={handleClose}\n disabled={state.pending || isCloseDisabled}\n className={actionText.toLowerCase()}\n >\n {state.pending ? (\n <Widget\n src=\"bluebiu.near/widget/0vix.LendingLoadingIcon\"\n props={{\n size: 16,\n }}\n />\n ) : (\n \"Close\"\n )}\n </Button>\n );\n}\n\nif (!_assetAmount) {\n return (\n <Button disabled={true} className={actionText.toLowerCase()}>\n Enter An Amount\n </Button>\n );\n}\n\nif (IS_GRAVITA_DAPP && IS_PREON_DAPP && IS_LYVE_DAPP) {\n if (isDebtBigerThanBalance) {\n return (\n <Button disabled={true} className={actionText.toLowerCase()}>\n Insufficient Balance\n </Button>\n );\n }\n if (Big(yourLTV).gt(Big(data.MAX_LTV).mul(100))) {\n return (\n <Button disabled={true} className={actionText.toLowerCase()}>\n LTV must be below {Big(data.MAX_LTV).mul(100).toFixed(2)}%\n </Button>\n );\n }\n}\nif (IS_ETHOS_DAPP) {\n if (\n Big(collateralRatio || 0)\n .mul(100)\n .lt(Big(data.MCR).mul(100))\n ) {\n return (\n <Button disabled={true} className={actionText.toLowerCase()}>\n {`Collateral Ratio must above the MCR of ${Big(data.MCR).mul(100)}%`}\n </Button>\n );\n }\n}\n\nif (Big(_debtTokenAmount || 0).lt(data[\"MIN_DEBT\"])) {\n return (\n <Button disabled={true} className={actionText.toLowerCase()}>\n A minimum of {data[\"MIN_DEBT\"]} {data.BORROW_TOKEN}\n </Button>\n );\n}\n\nconst tokenAddr = data.underlyingToken.address;\nconst spender = data.config.BorrowerOperations;\n\nconsole.log(\"APPROVE: \", tokenAddr, spender, props);\n\nconst getAllowance = () => {\n const TokenContract = new ethers.Contract(\n tokenAddr,\n ERC20_ABI,\n Ethers.provider().getSigner()\n );\n TokenContract.allowance(account, spender).then((allowanceRaw) => {\n console.log(\"ALLOWANCE:\", allowanceRaw.toString());\n State.update({\n isApproved: !Big(\n ethers.utils.formatUnits(\n allowanceRaw._hex,\n data.underlyingToken.decimals\n )\n ).lt(_assetAmount || \"0\"),\n });\n });\n};\n\nif ([\"Borrow\"].includes(actionText)) {\n getAllowance();\n}\n\nif (!state.isApproved) {\n const handleApprove = () => {\n const toastId = toast?.loading({\n title: `Approve ${Big(_assetAmount).toFixed(2)} ${tokenSymbol}`,\n });\n State.update({\n approving: true,\n });\n\n const TokenContract = new ethers.Contract(\n tokenAddr,\n ERC20_ABI,\n Ethers.provider().getSigner()\n );\n TokenContract.approve(\n spender,\n ethers.utils.parseUnits(_assetAmount, data.underlyingToken.decimals)\n )\n .then((tx) => {\n tx.wait()\n .then((res) => {\n const { status, transactionHash } = res;\n toast?.dismiss(toastId);\n if (status !== 1) throw new Error(\"\");\n State.update({\n isApproved: true,\n approving: false,\n });\n toast?.success({\n title: \"Approve Successfully!\",\n text: `Approve ${Big(_assetAmount).toFixed(2)} ${tokenSymbol}`,\n tx: transactionHash,\n chainId,\n });\n onApprovedSuccess();\n })\n .catch((err) => {\n State.update({\n isApproved: false,\n approving: false,\n });\n });\n })\n .catch((err) => {\n State.update({\n isApproved: false,\n approving: false,\n });\n toast?.dismiss(toastId);\n toast?.fail({\n title: \"Approve Failed!\",\n text: err?.message?.includes(\"user rejected transaction\")\n ? \"User rejected transaction\"\n : `Approve ${Big(_assetAmount).toFixed(2)} ${tokenSymbol}`,\n });\n onLoad?.(false);\n });\n };\n return (\n <Button onClick={handleApprove} disabled={state.approving}>\n {state.approving ? (\n <Widget\n src=\"bluebiu.near/widget/0vix.LendingLoadingIcon\"\n props={{\n size: 16,\n }}\n />\n ) : (\n \"Approve\"\n )}\n </Button>\n );\n}\n\nfunction makeOpenContract() {\n if (IS_PREON_DAPP || IS_GRAVITA_DAPP || IS_LYVE_DAPP) {\n const _asset = data.underlyingToken.address;\n const _assetAmount = ethers.utils.parseUnits(\n _assetAmount,\n data.underlyingToken.decimals\n );\n const _debtTokenAmount = ethers.utils.parseUnits(\n _debtTokenAmount,\n data.decimals\n );\n const _upperHint = \"0x544f96434f77437425d5aC40fd4755C0cf39399A\";\n const _lowerHint = \"0xA1B7bbade134DB3B14B56056480e81c60Ab77377\";\n const params = [\n _asset,\n _assetAmount,\n _debtTokenAmount,\n _upperHint,\n _lowerHint,\n ];\n const contract = new ethers.Contract(\n data.config.BorrowerOperations,\n [\n {\n inputs: [\n { internalType: \"address\", name: \"_asset\", type: \"address\" },\n { internalType: \"uint256\", name: \"_assetAmount\", type: \"uint256\" },\n {\n internalType: \"uint256\",\n name: \"_debtTokenAmount\",\n type: \"uint256\",\n },\n { internalType: \"address\", name: \"_upperHint\", type: \"address\" },\n { internalType: \"address\", name: \"_lowerHint\", type: \"address\" },\n ],\n name: \"openVessel\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n ],\n Ethers.provider().getSigner()\n );\n\n return contract.openVessel(...params, {\n gasLimit: GAS_LIMIT_RECOMMENDATIONS[\"borrow\"].limit,\n });\n }\n\n if (IS_ETHOS_DAPP) {\n const _collateral = data.underlyingToken.address;\n const _collAmount = ethers.utils.parseUnits(\n _assetAmount,\n data.underlyingToken.decimals\n );\n const _LUSDAmount = ethers.utils.parseUnits(\n _debtTokenAmount,\n data.decimals\n );\n const _upperHint = \"0xc655B790FF812109c8F6c3f24fd20b3495164A51\";\n const _lowerHint = \"0x0000000000000000000000000000000000000000\";\n const params = [\n _collateral,\n _collAmount,\n _maxFeePercentage,\n _LUSDAmount,\n _upperHint,\n _lowerHint,\n ];\n\n const contract = new ethers.Contract(\n data.config.BorrowerOperations,\n [\n {\n inputs: [\n { internalType: \"address\", name: \"_collateral\", type: \"address\" },\n { internalType: \"uint256\", name: \"_collAmount\", type: \"uint256\" },\n {\n internalType: \"uint256\",\n name: \"_maxFeePercentage\",\n type: \"uint256\",\n },\n { internalType: \"uint256\", name: \"_LUSDAmount\", type: \"uint256\" },\n { internalType: \"address\", name: \"_upperHint\", type: \"address\" },\n { internalType: \"address\", name: \"_lowerHint\", type: \"address\" },\n ],\n name: \"openTrove\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n ],\n Ethers.provider().getSigner()\n );\n\n return contract.openTrove(...params, {\n gasLimit: 4000000,\n });\n }\n}\n\nfunction handleBorrow() {\n State.update({\n pending: true,\n });\n\n makeOpenContract()\n .then((tx) => {\n tx.wait()\n .then((res) => {\n const { status, transactionHash } = res;\n toast?.dismiss(toastId);\n State.update({\n pending: false,\n });\n addAction?.({\n type: \"Lending\",\n action: actionText,\n token: data.underlyingToken,\n amount: _assetAmount,\n template: data.config.name,\n add: false,\n status,\n transactionHash,\n });\n if (status === 1) {\n onSuccess?.(data.dapp);\n toast?.success({\n title: `${tokenSymbol} ${actionText.toLowerCase()} request successed!`,\n tx: transactionHash,\n chainId,\n });\n } else {\n toast?.fail({\n title: `${tokenSymbol} ${actionText.toLowerCase()} request failed!`,\n tx: transactionHash,\n chainId,\n });\n }\n })\n .catch((err) => {\n State.update({\n pending: false,\n });\n });\n })\n .catch((err) => {\n console.log(\"openVessel_error:\", err);\n State.update({\n pending: false,\n });\n\n toast?.dismiss(toastId);\n toast?.fail({\n title: err?.message?.includes(\"user rejected transaction\")\n ? \"User rejected transaction\"\n : `${tokenSymbol} ${actionText.toLowerCase()} request failed!`,\n tx: err ? err.hash : \"\",\n chainId,\n });\n });\n}\n\nreturn (\n <>\n <Button\n disabled={state.pending || estimating || !state.isGasEnough}\n className={actionText.toLowerCase()}\n onClick={handleBorrow}\n >\n {state.pending || estimating ? (\n <Widget\n src=\"bluebiu.near/widget/0vix.LendingLoadingIcon\"\n props={{\n size: 16,\n }}\n />\n ) : !state.isGasEnough ? (\n `Not enough gas(${Big(state.gas || 0).toFixed(2)}) needed`\n ) : (\n actionText\n )}\n </Button>\n </>\n);\n" }, "Lending.Liquity.PoolButton": { "": "const ERC20_ABI = [\n {\n constant: true,\n inputs: [\n {\n name: \"_owner\",\n type: \"address\",\n },\n {\n name: \"_spender\",\n type: \"address\",\n },\n ],\n name: \"allowance\",\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n },\n ],\n payable: false,\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n constant: false,\n inputs: [\n {\n name: \"_spender\",\n type: \"address\",\n },\n {\n name: \"_value\",\n type: \"uint256\",\n },\n ],\n name: \"approve\",\n outputs: [\n {\n name: \"\",\n type: \"bool\",\n },\n ],\n payable: false,\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n];\nconst Button = styled.button`\n background-color: var(--switch-color);\n line-height: 46px;\n height: 46px;\n border-radius: 10px;\n color: var(--button-text-color);\n font-size: 18px;\n font-weight: 500;\n border: none;\n width: 100%;\n transition: 0.5s;\n &:hover {\n opacity: 0.8;\n }\n &:disabled {\n opacity: 0.5;\n }\n &.borrow {\n background-color: var(--repay-border-color);\n border: 1px solid var(--repay-border-color);\n }\n &.repay {\n background-color: var(--repay-bg-hover-color);\n border: 1px solid var(--repay-border-color);\n }\n &.close {\n width: 408px;\n background-color: var(--repay-border-color);\n border: 1px solid var(--repay-border-color);\n }\n`;\n\nconst {\n actionText,\n amount,\n data,\n chainId,\n onSuccess,\n toast,\n addAction,\n loading: estimating,\n gas,\n onApprovedSuccess,\n isBigerThanBalance,\n IS_ETHOS_DAPP,\n IS_PREON_DAPP,\n IS_GRAVITA_DAPP,\n IS_LYVE_DAPP,\n} = props;\n\n// for Yours\nconst account = Ethers.send(\"eth_requestAccounts\", [])[0];\n\nconst tokenSymbol = data.underlyingToken.symbol;\nif (!actionText) return;\n\nuseEffect(() => {\n State.update({\n approving: false,\n isApproved: true,\n isGasEnough: true,\n });\n}, []);\n\nuseEffect(() => {\n if (!account || !gas) return;\n const provider = Ethers.provider();\n provider.getBalance(account).then((rawBalance) => {\n State.update({\n gasBalance: rawBalance.toString(),\n isGasEnough: !Big(rawBalance.toString()).lt(gas.toString()),\n gas: ethers.utils.formatUnits(gas, 18),\n });\n });\n}, [account, gas]);\n\nif (!amount) {\n return (\n <Button disabled={true} className={actionText.toLowerCase()}>\n Enter An Amount\n </Button>\n );\n}\n\nif (isBigerThanBalance) {\n return (\n <Button disabled={true} className={actionText.toLowerCase()}>\n Insufficient Balance\n </Button>\n );\n}\n\nconst tokenAddr = data.config.borrowTokenAddress;\nlet spender;\nif (IS_ETHOS_DAPP || IS_PREON_DAPP || IS_GRAVITA_DAPP) {\n spender = data.config.BorrowerOperations;\n}\nif (IS_LYVE_DAPP) {\n spender = data.config.StabilityPool;\n}\n\nconsole.log(\"APPROVE: \", tokenAddr, spender, props);\n\nconst getAllowance = () => {\n const TokenContract = new ethers.Contract(\n tokenAddr,\n ERC20_ABI,\n Ethers.provider().getSigner()\n );\n TokenContract.allowance(account, spender).then((allowanceRaw) => {\n console.log(\"ALLOWANCE:\", allowanceRaw.toString());\n State.update({\n isApproved: !Big(\n ethers.utils.formatUnits(\n allowanceRaw._hex,\n data.underlyingToken.decimals\n )\n ).lt(amount || \"0\"),\n });\n });\n};\n\nif ([\"Deposit\"].includes(actionText)) {\n getAllowance();\n}\n\nif (!state.isApproved) {\n const handleApprove = () => {\n const toastId = toast?.loading({\n title: `Approve ${Big(amount).toFixed(2)} ${tokenSymbol}`,\n });\n State.update({\n approving: true,\n });\n\n const TokenContract = new ethers.Contract(\n tokenAddr,\n ERC20_ABI,\n Ethers.provider().getSigner()\n );\n TokenContract.approve(\n spender,\n ethers.utils.parseUnits(amount, data.underlyingToken.decimals)\n )\n .then((tx) => {\n tx.wait()\n .then((res) => {\n const { status, transactionHash } = res;\n toast?.dismiss(toastId);\n if (status !== 1) throw new Error(\"\");\n State.update({\n isApproved: true,\n approving: false,\n });\n toast?.success({\n title: \"Approve Successfully!\",\n text: `Approve ${Big(amount).toFixed(2)} ${tokenSymbol}`,\n tx: transactionHash,\n chainId,\n });\n onApprovedSuccess();\n })\n .catch((err) => {\n State.update({\n isApproved: false,\n approving: false,\n });\n });\n })\n .catch((err) => {\n State.update({\n isApproved: false,\n approving: false,\n });\n toast?.dismiss(toastId);\n toast?.fail({\n title: \"Approve Failed!\",\n text: err?.message?.includes(\"user rejected transaction\")\n ? \"User rejected transaction\"\n : `Approve ${Big(amount).toFixed(2)} ${tokenSymbol}`,\n });\n onLoad?.(false);\n });\n };\n return (\n <Button onClick={handleApprove} disabled={state.approving}>\n {state.approving ? (\n <Widget\n src=\"bluebiu.near/widget/0vix.LendingLoadingIcon\"\n props={{\n size: 16,\n }}\n />\n ) : (\n \"Approve\"\n )}\n </Button>\n );\n}\n\nfunction handleClick() {\n State.update({\n pending: true,\n });\n console.log(\"click:\", actionText, data);\n let abi;\n if (data.BORROW_TOKEN === \"GRAI\" || data.BORROW_TOKEN === \"LYU\") {\n abi = [\n {\n inputs: [\n { internalType: \"uint256\", name: \"_amount\", type: \"uint256\" },\n { internalType: \"address[]\", name: \"_assets\", type: \"address[]\" },\n ],\n name: \"provideToSP\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"uint256\", name: \"_amount\", type: \"uint256\" },\n { internalType: \"address[]\", name: \"_assets\", type: \"address[]\" },\n ],\n name: \"withdrawFromSP\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n ];\n }\n if (data.BORROW_TOKEN === \"STAR\" || data.BORROW_TOKEN === \"ERN\") {\n abi = [\n {\n inputs: [{ internalType: \"uint256\", name: \"_amount\", type: \"uint256\" }],\n name: \"provideToSP\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"uint256\", name: \"_amount\", type: \"uint256\" }],\n name: \"withdrawFromSP\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n ];\n }\n const contract = new ethers.Contract(\n data.config.StabilityPool,\n abi,\n Ethers.provider().getSigner()\n );\n\n const tokenArray = Object.keys(data.config.markets);\n\n const _amount = ethers.utils.parseUnits(amount);\n let params = {};\n if (data.BORROW_TOKEN === \"GRAI\") {\n params = [_amount, tokenArray];\n }\n if (data.BORROW_TOKEN === \"LYU\") {\n params = [_amount, [\"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f\"]];\n }\n\n if (data.BORROW_TOKEN === \"STAR\" || data.BORROW_TOKEN === \"ERN\") {\n params = [_amount];\n }\n console.log(\"dw_params:\", params);\n if (actionText === \"Deposit\") {\n contract\n .provideToSP(...params, {\n gasLimit: 700000,\n })\n .then((tx) => {\n tx.wait()\n .then((res) => {\n const { status, transactionHash } = res;\n toast?.dismiss(toastId);\n State.update({\n pending: false,\n });\n // addAction?.({\n // type: \"Lending\",\n // action: actionText,\n // token: data.underlyingToken,\n // amount,\n // template: data.config.name,\n // add: false,\n // status,\n // transactionHash,\n // });\n if (status === 1) {\n onSuccess?.(data.dapp);\n toast?.success({\n title: `${tokenSymbol} ${actionText.toLowerCase()} request successed!`,\n tx: transactionHash,\n chainId,\n });\n } else {\n toast?.fail({\n title: `${tokenSymbol} ${actionText.toLowerCase()} request failed!`,\n tx: transactionHash,\n chainId,\n });\n }\n })\n .catch((err) => {\n State.update({\n pending: false,\n });\n });\n })\n .catch((err) => {\n State.update({\n pending: false,\n });\n\n toast?.dismiss(toastId);\n toast?.fail({\n title: err?.message?.includes(\"user rejected transaction\")\n ? \"User rejected transaction\"\n : `${tokenSymbol} ${actionText.toLowerCase()} request failed!`,\n tx: err ? err.hash : \"\",\n chainId,\n });\n });\n }\n if (actionText === \"Withdraw\") {\n contract\n .withdrawFromSP(...params, {\n gasLimit: 700000,\n })\n .then((tx) => {\n tx.wait()\n .then((res) => {\n const { status, transactionHash } = res;\n toast?.dismiss(toastId);\n State.update({\n pending: false,\n });\n // addAction?.({\n // type: \"Lending\",\n // action: actionText,\n // token: data.underlyingToken,\n // amount,\n // template: data.config.name,\n // add: false,\n // status,\n // transactionHash,\n // });\n if (status === 1) {\n onSuccess?.(data.dapp);\n toast?.success({\n title: `${tokenSymbol} ${actionText.toLowerCase()} request successed!`,\n tx: transactionHash,\n chainId,\n });\n } else {\n toast?.fail({\n title: `${tokenSymbol} ${actionText.toLowerCase()} request failed!`,\n tx: transactionHash,\n chainId,\n });\n }\n })\n .catch((err) => {\n State.update({\n pending: false,\n });\n });\n })\n .catch((err) => {\n State.update({\n pending: false,\n });\n\n toast?.dismiss(toastId);\n toast?.fail({\n title: err?.message?.includes(\"user rejected transaction\")\n ? \"User rejected transaction\"\n : `${tokenSymbol} ${actionText.toLowerCase()} request failed!`,\n tx: err ? err.hash : \"\",\n chainId,\n });\n });\n }\n}\n\nreturn (\n <>\n <Button\n disabled={state.pending}\n className={actionText.toLowerCase()}\n onClick={handleClick}\n >\n {state.pending ? (\n <Widget\n src=\"bluebiu.near/widget/0vix.LendingLoadingIcon\"\n props={{\n size: 16,\n }}\n />\n ) : (\n actionText\n )}\n </Button>\n </>\n);\n" } } } } }
Result:
{ "block_height": "119552025" }
No logs
Receipt:
Predecessor ID:
Receiver ID:
Gas Burned:
223 Ggas
Tokens Burned:
0 
Transferred 0.18638  to bluebiu.near
Empty result
No logs