Search
Search

Transaction: 6RoKva3...VhKo

Receiver
Status
Succeeded
Transaction Fee
0.00111 
Deposit Value
0.1249 
Gas Used
15 Tgas
Attached Gas
100 Tgas
Created
March 27, 2024 at 7:29:09am
Hash
6RoKva3Y4GsNgd9HkNacsKTXB8oEkU5Gj78t7SQVhKo

Actions

Called method: 'set' in contract: social.near
Arguments:
{ "data": { "c5d8ae6a463b23253d799fd788cccb3497a49f9cc999b626248d459b85e42174": { "widget": { "LockLP": { "": "const REF_CONTRACT_ID = \"v2.ref-finance.near\";\nconst CONTRACT_ID = \"lock-lp.near\";\nconst RPC_URL = \"https://rpc.mainnet.near.org\";\n\nconst poolId = parseInt(props.poolId);\n\nconst [isLocking, setLocking] = useState(false);\n\nconst [shareBalance, setShareBalance] = useState(\"0\");\nconst [amount, setAmount] = useState(shareBalance ?? \"0\");\nconst [totalLockedBalance, setTotalLockedBalance] = useState(\"0\");\nconst [burnedBalance, setBurnedBalance] = useState(\"0\");\nconst [lockedBalance, setLockedBalance] = useState(\"0\");\nconst [unlockTime, setUnlockTime] = useState(undefined);\nconst [poolRegistered, setPoolRegistered] = useState(undefined);\nconst [nearBalance, setNearBalance] = useState(\"0\");\nconst [lockDurationNs, setLockDurationNs] = useState(\n 1 * 365 * 24 * 60 * 60 * 1000 * 1_000_000\n);\nconst [mftRegistered, setMftRegistered] = useState(undefined);\nconst [registerCost, setRegisterCost] = useState(undefined);\nNear.asyncView(CONTRACT_ID, \"get_register_cost\", {}).then((cost) =>\n setRegisterCost(ethers.BigNumber.from(cost))\n);\n\nNear.asyncView(REF_CONTRACT_ID, \"mft_balance_of\", {\n token_id: \":\" + poolId,\n account_id: context.accountId,\n}).then((balance) => setShareBalance(balance));\n\nfunction changeLockDurationDays(days) {\n if (days < 0.001) days = 0.001;\n setLockDurationNs(days * 24 * 60 * 60 * 1000 * 1_000_000);\n}\n\nasyncFetch(RPC_URL, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n id: \"dontcare\",\n method: \"query\",\n jsonrpc: \"2.0\",\n params: {\n request_type: \"view_account\",\n finality: \"final\",\n account_id: context.accountId,\n },\n }),\n}).then((res) => {\n setNearBalance(res.body.result.amount);\n});\n\nfunction updateLockedBalance() {\n Near.asyncView(poolId + \".\" + CONTRACT_ID, \"get_lockup\", {\n account_id: context.accountId,\n })\n .then((res) => {\n if (res) {\n setLockedBalance(res.amount);\n setUnlockTime(parseInt(res.timestamp) + parseInt(res.duration_ns));\n }\n setPoolRegistered(true);\n })\n .catch((err) => {\n console.log(err);\n setPoolRegistered(false);\n });\n\n Near.asyncView(REF_CONTRACT_ID, \"mft_balance_of\", {\n account_id: poolId + \".\" + CONTRACT_ID,\n token_id: \":\" + poolId,\n }).then((balance) => {\n setTotalLockedBalance(balance);\n });\n\n Near.asyncView(REF_CONTRACT_ID, \"mft_balance_of\", {\n account_id: \"0\".repeat(64),\n token_id: \":\" + poolId,\n }).then((balance) => {\n setBurnedBalance(balance);\n });\n\n Near.asyncView(REF_CONTRACT_ID, \"mft_has_registered\", {\n token_id: \":\" + poolId,\n account_id: poolId + \".\" + CONTRACT_ID,\n }).then((registered) => setMftRegistered(registered));\n}\n\nif (shareBalance === null) {\n Near.asyncView(REF_CONTRACT_ID, \"mft_balance_of\", {\n token_id: \":\" + poolId,\n account_id: context.accountId,\n }).then((balance) => {\n shareBalance = balance;\n setAmount(shareBalance);\n });\n}\n\nconst [poolInfo, setPoolInfo] = useState(undefined);\nNear.asyncView(REF_CONTRACT_ID, \"get_pool\", {\n pool_id: poolId,\n}).then((pool) => {\n pool.token0 = Near.view(pool.token_account_ids[0], \"ft_metadata\", {});\n pool.token1 = Near.view(pool.token_account_ids[1], \"ft_metadata\", {});\n setPoolInfo(pool);\n});\n\nupdateLockedBalance();\n\nfunction changeAmount(p) {\n if (p.length === 0) {\n p = \"0\";\n }\n while (p.startsWith(\"0\") && p.length > 1) {\n p = p.substring(1);\n }\n if (!/^\\d+$/.test(p)) setAmount(amount);\n else\n setAmount(\n ethers.BigNumber.from(p).gt(ethers.BigNumber.from(shareBalance))\n ? shareBalance\n : ethers.BigNumber.from(p).gt(ethers.BigNumber.from(\"0\"))\n ? p\n : \"0\"\n );\n}\n\nfunction lockLp() {\n if (mftRegistered === false) {\n Near.call(\n REF_CONTRACT_ID,\n \"mft_register\",\n {\n token_id: \":\" + poolId,\n account_id: poolId + \".\" + CONTRACT_ID,\n },\n \"300000000000000\",\n \"89000000000000000000000\"\n );\n } else if (unlockTime === undefined) {\n Near.call(\n poolId + \".\" + CONTRACT_ID,\n \"register_lockup\",\n {},\n \"300000000000000\",\n \"100000000000000000000000\"\n );\n } else {\n Near.call(\n REF_CONTRACT_ID,\n \"mft_transfer_call\",\n {\n token_id: \":\" + poolId,\n receiver_id: poolId + \".\" + CONTRACT_ID,\n amount: amount,\n msg: Math.floor(lockDurationNs).toString(),\n },\n \"300000000000000\",\n \"1\"\n ).then((res) => {\n setAmount(\"0\");\n updateLockedBalance();\n });\n }\n}\n\nfunction unlockLp() {\n Near.call(\n poolId + \".\" + CONTRACT_ID,\n \"withdraw\",\n {},\n \"300000000000000\",\n \"1\"\n ).then(() => {\n updateLockedBalance();\n });\n}\n\nfunction registerPair() {\n Near.call(\n CONTRACT_ID,\n \"register_pool\",\n {\n pool_id: poolId.toString(),\n ref_address: REF_CONTRACT_ID,\n },\n \"300000000000000\",\n registerCost.toString()\n ).then(() => {\n updateLockedBalance();\n });\n}\n\nconst HorizontalList = styled.div`\n width: 400px;\n display: flex;\n flex-direction: row;\n justify-content: space-around;\n`;\n\nfunction toHumanTimeDiff(ns) {\n let ms = ns / 1_000_000;\n let d = Math.floor(ms / 1000 / 60 / 60 / 24);\n let h = Math.floor(ms / 1000 / 60 / 60) % 24;\n let m = Math.floor(ms / 1000 / 60) % 60;\n\n if (d === 0) {\n return `${h}h ${m}m`;\n } else {\n return `${d}d ${h}h`;\n }\n}\n\nconsole.log(poolId);\n\nif (!poolId) {\n return (\n <>\n <h1>Lock LP tokens of your shitcoin</h1>\n <ul>\n <li>\n <a href=\"?poolId=4769\">TOUCH-wNEAR</a>\n </li>\n </ul>\n <h2>\n Product not audited, use at your own risk. Withdrawals are disabled\n until audited.\n </h2>\n </>\n );\n}\n\nreturn poolInfo ? (\n <>\n Pool:{\" \"}\n <a href={`https://nearblocks.io/token/${poolInfo.token_account_ids[0]}`}>\n {poolInfo.token0.symbol}\n </a>\n -\n <a href={`https://nearblocks.io/token/${poolInfo.token_account_ids[1]}`}>\n {poolInfo.token1.symbol}\n </a>{\" \"}\n <a href={`https://app.ref.finance/pool/${poolId}`}>(#{poolId})</a>\n <br />\n Burned:{\" \"}\n {ethers.BigNumber.from(burnedBalance)\n .mul(ethers.BigNumber.from(100))\n .div(ethers.BigNumber.from(poolInfo.shares_total_supply))\n .toString()}\n % (\n {ethers.BigNumber.from(burnedBalance)\n .mul(ethers.BigNumber.from(poolInfo.amounts[0]))\n .div(ethers.BigNumber.from(poolInfo.shares_total_supply))\n .div(ethers.BigNumber.from(10).pow(poolInfo.token0.decimals))\n .toString()}{\" \"}\n {poolInfo.token0.symbol} &{\" \"}\n {ethers.BigNumber.from(burnedBalance)\n .mul(ethers.BigNumber.from(poolInfo.amounts[1]))\n .div(ethers.BigNumber.from(poolInfo.shares_total_supply))\n .div(ethers.BigNumber.from(10).pow(poolInfo.token1.decimals))\n .toString()}\n {poolInfo.token1.symbol}\n {isLocking && `, or ${burnedBalance} shares`})\n <br />\n Locked:{\" \"}\n {ethers.BigNumber.from(totalLockedBalance)\n .mul(ethers.BigNumber.from(100))\n .div(ethers.BigNumber.from(poolInfo.shares_total_supply))\n .toString()}\n % (\n {ethers.BigNumber.from(totalLockedBalance)\n .mul(ethers.BigNumber.from(poolInfo.amounts[0]))\n .div(ethers.BigNumber.from(poolInfo.shares_total_supply))\n .div(ethers.BigNumber.from(10).pow(poolInfo.token0.decimals))\n .toString()}{\" \"}\n {poolInfo.token0.symbol} &{\" \"}\n {ethers.BigNumber.from(totalLockedBalance)\n .mul(ethers.BigNumber.from(poolInfo.amounts[1]))\n .div(ethers.BigNumber.from(poolInfo.shares_total_supply))\n .div(ethers.BigNumber.from(10).pow(poolInfo.token1.decimals))\n .toString()}\n {poolInfo.token1.symbol}\n {isLocking && `, or ${totalLockedBalance} shares`})\n <br />\n <br />\n <button onClick={() => setLocking(!isLocking)}>Lock</button>\n {isLocking && (\n <>\n {poolRegistered && (\n <>\n <br />\n <br />\n <HorizontalList>\n Shares to lock:\n <input\n type=\"text\"\n value={amount}\n onChange={(e) => changeAmount(e.target.value)}\n ></input>\n <button\n onClick={() => changeAmount(shareBalance)}\n disabled={amount === shareBalance}\n >\n Max\n </button>\n </HorizontalList>\n <br />\n <HorizontalList>\n Duration (days):\n <input\n type=\"number\"\n value={(\n lockDurationNs /\n 24 /\n 60 /\n 60 /\n 1000 /\n 1_000_000\n ).toFixed(3)}\n onChange={(e) => changeLockDurationDays(e.target.value)}\n ></input>\n </HorizontalList>\n <br />\n Your balance: {shareBalance} shares\n <br />\n Going to lock: {amount} shares (\n {ethers.BigNumber.from(amount)\n .mul(ethers.BigNumber.from(100))\n .div(ethers.BigNumber.from(poolInfo.shares_total_supply))\n .toString()}\n %,\n {ethers.BigNumber.from(amount)\n .mul(ethers.BigNumber.from(poolInfo.amounts[0]))\n .div(ethers.BigNumber.from(poolInfo.shares_total_supply))\n .div(ethers.BigNumber.from(10).pow(poolInfo.token0.decimals))\n .toString()}{\" \"}\n {poolInfo.token0.symbol} &{\" \"}\n {ethers.BigNumber.from(amount)\n .mul(ethers.BigNumber.from(poolInfo.amounts[1]))\n .div(ethers.BigNumber.from(poolInfo.shares_total_supply))\n .div(ethers.BigNumber.from(10).pow(poolInfo.token1.decimals))\n .toString()}{\" \"}\n {poolInfo.token1.symbol})\n <br />\n <button\n disabled={\n amount === \"0\" ||\n lockDurationNs === 0 ||\n Date.now() * 1_000_000 + lockDurationNs < unlockTime\n }\n onClick={() => lockLp()}\n >\n {mftRegistered === false\n ? \"Register LP holder\"\n : unlockTime === undefined\n ? \"Create a lockup account\"\n : \"Lock LP\"}\n </button>\n {Date.now() * 1_000_000 + lockDurationNs < unlockTime && (\n <>\n <br />\n You can't lock with unlock date earlier than your existing\n lockup\n </>\n )}\n {lockedBalance !== \"0\" && unlockTime !== undefined && (\n <>\n <br />\n <br />\n Can unlock in:{\" \"}\n {unlockTime > Date.now() * 1_000_000\n ? toHumanTimeDiff(unlockTime - Date.now() * 1_000_000)\n : \"Now\"}\n <br />\n <button\n disabled={unlockTime > Date.now() * 1_000_000}\n onClick={() => unlockLp()}\n >\n Unlock LP\n </button>\n </>\n )}\n </>\n )}\n {poolRegistered === false && (\n <>\n <br />\n <br />\n <button\n disabled={ethers.BigNumber.from(nearBalance).lt(registerCost)}\n onClick={() => registerPair()}\n >\n Register this pair\n </button>\n <br />\n It costs{\" \"}\n {registerCost\n .div(ethers.BigNumber.from(10).pow(24))\n .toString()}{\" \"}\n NEAR\n {ethers.BigNumber.from(nearBalance).gte(registerCost)\n ? \"(you have enough)\"\n : `(you only have: ${ethers.BigNumber.from(nearBalance)\n .div(ethers.BigNumber.from(10).pow(24))\n .toString()}, this is not enough)`}\n </>\n )}\n <br />\n <br />\n <button onClick={() => updateLockedBalance()}>\n Update (click here after sending every transaction)\n </button>\n </>\n )}\n <br />\n <br />\n <h2>\n Product not audited, use at your own risk. Withdrawals are disabled until\n audited.\n </h2>\n </>\n) : (\n \"Loading ...\"\n);\n", "metadata": { "fork_of": "slimedragon.near/widget/LockLP@114929513" } } } } } }

Transaction Execution Plan

Convert Transaction To Receipt
Gas Burned:
2 Tgas
Tokens Burned:
0.00025 
Receipt:
Predecessor ID:
Receiver ID:
Gas Burned:
8 Tgas
Tokens Burned:
0.00087 
Called method: 'set' in contract: social.near
Arguments:
{ "data": { "c5d8ae6a463b23253d799fd788cccb3497a49f9cc999b626248d459b85e42174": { "widget": { "LockLP": { "": "const REF_CONTRACT_ID = \"v2.ref-finance.near\";\nconst CONTRACT_ID = \"lock-lp.near\";\nconst RPC_URL = \"https://rpc.mainnet.near.org\";\n\nconst poolId = parseInt(props.poolId);\n\nconst [isLocking, setLocking] = useState(false);\n\nconst [shareBalance, setShareBalance] = useState(\"0\");\nconst [amount, setAmount] = useState(shareBalance ?? \"0\");\nconst [totalLockedBalance, setTotalLockedBalance] = useState(\"0\");\nconst [burnedBalance, setBurnedBalance] = useState(\"0\");\nconst [lockedBalance, setLockedBalance] = useState(\"0\");\nconst [unlockTime, setUnlockTime] = useState(undefined);\nconst [poolRegistered, setPoolRegistered] = useState(undefined);\nconst [nearBalance, setNearBalance] = useState(\"0\");\nconst [lockDurationNs, setLockDurationNs] = useState(\n 1 * 365 * 24 * 60 * 60 * 1000 * 1_000_000\n);\nconst [mftRegistered, setMftRegistered] = useState(undefined);\nconst [registerCost, setRegisterCost] = useState(undefined);\nNear.asyncView(CONTRACT_ID, \"get_register_cost\", {}).then((cost) =>\n setRegisterCost(ethers.BigNumber.from(cost))\n);\n\nNear.asyncView(REF_CONTRACT_ID, \"mft_balance_of\", {\n token_id: \":\" + poolId,\n account_id: context.accountId,\n}).then((balance) => setShareBalance(balance));\n\nfunction changeLockDurationDays(days) {\n if (days < 0.001) days = 0.001;\n setLockDurationNs(days * 24 * 60 * 60 * 1000 * 1_000_000);\n}\n\nasyncFetch(RPC_URL, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n id: \"dontcare\",\n method: \"query\",\n jsonrpc: \"2.0\",\n params: {\n request_type: \"view_account\",\n finality: \"final\",\n account_id: context.accountId,\n },\n }),\n}).then((res) => {\n setNearBalance(res.body.result.amount);\n});\n\nfunction updateLockedBalance() {\n Near.asyncView(poolId + \".\" + CONTRACT_ID, \"get_lockup\", {\n account_id: context.accountId,\n })\n .then((res) => {\n if (res) {\n setLockedBalance(res.amount);\n setUnlockTime(parseInt(res.timestamp) + parseInt(res.duration_ns));\n }\n setPoolRegistered(true);\n })\n .catch((err) => {\n console.log(err);\n setPoolRegistered(false);\n });\n\n Near.asyncView(REF_CONTRACT_ID, \"mft_balance_of\", {\n account_id: poolId + \".\" + CONTRACT_ID,\n token_id: \":\" + poolId,\n }).then((balance) => {\n setTotalLockedBalance(balance);\n });\n\n Near.asyncView(REF_CONTRACT_ID, \"mft_balance_of\", {\n account_id: \"0\".repeat(64),\n token_id: \":\" + poolId,\n }).then((balance) => {\n setBurnedBalance(balance);\n });\n\n Near.asyncView(REF_CONTRACT_ID, \"mft_has_registered\", {\n token_id: \":\" + poolId,\n account_id: poolId + \".\" + CONTRACT_ID,\n }).then((registered) => setMftRegistered(registered));\n}\n\nif (shareBalance === null) {\n Near.asyncView(REF_CONTRACT_ID, \"mft_balance_of\", {\n token_id: \":\" + poolId,\n account_id: context.accountId,\n }).then((balance) => {\n shareBalance = balance;\n setAmount(shareBalance);\n });\n}\n\nconst [poolInfo, setPoolInfo] = useState(undefined);\nNear.asyncView(REF_CONTRACT_ID, \"get_pool\", {\n pool_id: poolId,\n}).then((pool) => {\n pool.token0 = Near.view(pool.token_account_ids[0], \"ft_metadata\", {});\n pool.token1 = Near.view(pool.token_account_ids[1], \"ft_metadata\", {});\n setPoolInfo(pool);\n});\n\nupdateLockedBalance();\n\nfunction changeAmount(p) {\n if (p.length === 0) {\n p = \"0\";\n }\n while (p.startsWith(\"0\") && p.length > 1) {\n p = p.substring(1);\n }\n if (!/^\\d+$/.test(p)) setAmount(amount);\n else\n setAmount(\n ethers.BigNumber.from(p).gt(ethers.BigNumber.from(shareBalance))\n ? shareBalance\n : ethers.BigNumber.from(p).gt(ethers.BigNumber.from(\"0\"))\n ? p\n : \"0\"\n );\n}\n\nfunction lockLp() {\n if (mftRegistered === false) {\n Near.call(\n REF_CONTRACT_ID,\n \"mft_register\",\n {\n token_id: \":\" + poolId,\n account_id: poolId + \".\" + CONTRACT_ID,\n },\n \"300000000000000\",\n \"89000000000000000000000\"\n );\n } else if (unlockTime === undefined) {\n Near.call(\n poolId + \".\" + CONTRACT_ID,\n \"register_lockup\",\n {},\n \"300000000000000\",\n \"100000000000000000000000\"\n );\n } else {\n Near.call(\n REF_CONTRACT_ID,\n \"mft_transfer_call\",\n {\n token_id: \":\" + poolId,\n receiver_id: poolId + \".\" + CONTRACT_ID,\n amount: amount,\n msg: Math.floor(lockDurationNs).toString(),\n },\n \"300000000000000\",\n \"1\"\n ).then((res) => {\n setAmount(\"0\");\n updateLockedBalance();\n });\n }\n}\n\nfunction unlockLp() {\n Near.call(\n poolId + \".\" + CONTRACT_ID,\n \"withdraw\",\n {},\n \"300000000000000\",\n \"1\"\n ).then(() => {\n updateLockedBalance();\n });\n}\n\nfunction registerPair() {\n Near.call(\n CONTRACT_ID,\n \"register_pool\",\n {\n pool_id: poolId.toString(),\n ref_address: REF_CONTRACT_ID,\n },\n \"300000000000000\",\n registerCost.toString()\n ).then(() => {\n updateLockedBalance();\n });\n}\n\nconst HorizontalList = styled.div`\n width: 400px;\n display: flex;\n flex-direction: row;\n justify-content: space-around;\n`;\n\nfunction toHumanTimeDiff(ns) {\n let ms = ns / 1_000_000;\n let d = Math.floor(ms / 1000 / 60 / 60 / 24);\n let h = Math.floor(ms / 1000 / 60 / 60) % 24;\n let m = Math.floor(ms / 1000 / 60) % 60;\n\n if (d === 0) {\n return `${h}h ${m}m`;\n } else {\n return `${d}d ${h}h`;\n }\n}\n\nconsole.log(poolId);\n\nif (!poolId) {\n return (\n <>\n <h1>Lock LP tokens of your shitcoin</h1>\n <ul>\n <li>\n <a href=\"?poolId=4769\">TOUCH-wNEAR</a>\n </li>\n </ul>\n <h2>\n Product not audited, use at your own risk. Withdrawals are disabled\n until audited.\n </h2>\n </>\n );\n}\n\nreturn poolInfo ? (\n <>\n Pool:{\" \"}\n <a href={`https://nearblocks.io/token/${poolInfo.token_account_ids[0]}`}>\n {poolInfo.token0.symbol}\n </a>\n -\n <a href={`https://nearblocks.io/token/${poolInfo.token_account_ids[1]}`}>\n {poolInfo.token1.symbol}\n </a>{\" \"}\n <a href={`https://app.ref.finance/pool/${poolId}`}>(#{poolId})</a>\n <br />\n Burned:{\" \"}\n {ethers.BigNumber.from(burnedBalance)\n .mul(ethers.BigNumber.from(100))\n .div(ethers.BigNumber.from(poolInfo.shares_total_supply))\n .toString()}\n % (\n {ethers.BigNumber.from(burnedBalance)\n .mul(ethers.BigNumber.from(poolInfo.amounts[0]))\n .div(ethers.BigNumber.from(poolInfo.shares_total_supply))\n .div(ethers.BigNumber.from(10).pow(poolInfo.token0.decimals))\n .toString()}{\" \"}\n {poolInfo.token0.symbol} &{\" \"}\n {ethers.BigNumber.from(burnedBalance)\n .mul(ethers.BigNumber.from(poolInfo.amounts[1]))\n .div(ethers.BigNumber.from(poolInfo.shares_total_supply))\n .div(ethers.BigNumber.from(10).pow(poolInfo.token1.decimals))\n .toString()}\n {poolInfo.token1.symbol}\n {isLocking && `, or ${burnedBalance} shares`})\n <br />\n Locked:{\" \"}\n {ethers.BigNumber.from(totalLockedBalance)\n .mul(ethers.BigNumber.from(100))\n .div(ethers.BigNumber.from(poolInfo.shares_total_supply))\n .toString()}\n % (\n {ethers.BigNumber.from(totalLockedBalance)\n .mul(ethers.BigNumber.from(poolInfo.amounts[0]))\n .div(ethers.BigNumber.from(poolInfo.shares_total_supply))\n .div(ethers.BigNumber.from(10).pow(poolInfo.token0.decimals))\n .toString()}{\" \"}\n {poolInfo.token0.symbol} &{\" \"}\n {ethers.BigNumber.from(totalLockedBalance)\n .mul(ethers.BigNumber.from(poolInfo.amounts[1]))\n .div(ethers.BigNumber.from(poolInfo.shares_total_supply))\n .div(ethers.BigNumber.from(10).pow(poolInfo.token1.decimals))\n .toString()}\n {poolInfo.token1.symbol}\n {isLocking && `, or ${totalLockedBalance} shares`})\n <br />\n <br />\n <button onClick={() => setLocking(!isLocking)}>Lock</button>\n {isLocking && (\n <>\n {poolRegistered && (\n <>\n <br />\n <br />\n <HorizontalList>\n Shares to lock:\n <input\n type=\"text\"\n value={amount}\n onChange={(e) => changeAmount(e.target.value)}\n ></input>\n <button\n onClick={() => changeAmount(shareBalance)}\n disabled={amount === shareBalance}\n >\n Max\n </button>\n </HorizontalList>\n <br />\n <HorizontalList>\n Duration (days):\n <input\n type=\"number\"\n value={(\n lockDurationNs /\n 24 /\n 60 /\n 60 /\n 1000 /\n 1_000_000\n ).toFixed(3)}\n onChange={(e) => changeLockDurationDays(e.target.value)}\n ></input>\n </HorizontalList>\n <br />\n Your balance: {shareBalance} shares\n <br />\n Going to lock: {amount} shares (\n {ethers.BigNumber.from(amount)\n .mul(ethers.BigNumber.from(100))\n .div(ethers.BigNumber.from(poolInfo.shares_total_supply))\n .toString()}\n %,\n {ethers.BigNumber.from(amount)\n .mul(ethers.BigNumber.from(poolInfo.amounts[0]))\n .div(ethers.BigNumber.from(poolInfo.shares_total_supply))\n .div(ethers.BigNumber.from(10).pow(poolInfo.token0.decimals))\n .toString()}{\" \"}\n {poolInfo.token0.symbol} &{\" \"}\n {ethers.BigNumber.from(amount)\n .mul(ethers.BigNumber.from(poolInfo.amounts[1]))\n .div(ethers.BigNumber.from(poolInfo.shares_total_supply))\n .div(ethers.BigNumber.from(10).pow(poolInfo.token1.decimals))\n .toString()}{\" \"}\n {poolInfo.token1.symbol})\n <br />\n <button\n disabled={\n amount === \"0\" ||\n lockDurationNs === 0 ||\n Date.now() * 1_000_000 + lockDurationNs < unlockTime\n }\n onClick={() => lockLp()}\n >\n {mftRegistered === false\n ? \"Register LP holder\"\n : unlockTime === undefined\n ? \"Create a lockup account\"\n : \"Lock LP\"}\n </button>\n {Date.now() * 1_000_000 + lockDurationNs < unlockTime && (\n <>\n <br />\n You can't lock with unlock date earlier than your existing\n lockup\n </>\n )}\n {lockedBalance !== \"0\" && unlockTime !== undefined && (\n <>\n <br />\n <br />\n Can unlock in:{\" \"}\n {unlockTime > Date.now() * 1_000_000\n ? toHumanTimeDiff(unlockTime - Date.now() * 1_000_000)\n : \"Now\"}\n <br />\n <button\n disabled={unlockTime > Date.now() * 1_000_000}\n onClick={() => unlockLp()}\n >\n Unlock LP\n </button>\n </>\n )}\n </>\n )}\n {poolRegistered === false && (\n <>\n <br />\n <br />\n <button\n disabled={ethers.BigNumber.from(nearBalance).lt(registerCost)}\n onClick={() => registerPair()}\n >\n Register this pair\n </button>\n <br />\n It costs{\" \"}\n {registerCost\n .div(ethers.BigNumber.from(10).pow(24))\n .toString()}{\" \"}\n NEAR\n {ethers.BigNumber.from(nearBalance).gte(registerCost)\n ? \"(you have enough)\"\n : `(you only have: ${ethers.BigNumber.from(nearBalance)\n .div(ethers.BigNumber.from(10).pow(24))\n .toString()}, this is not enough)`}\n </>\n )}\n <br />\n <br />\n <button onClick={() => updateLockedBalance()}>\n Update (click here after sending every transaction)\n </button>\n </>\n )}\n <br />\n <br />\n <h2>\n Product not audited, use at your own risk. Withdrawals are disabled until\n audited.\n </h2>\n </>\n) : (\n \"Loading ...\"\n);\n", "metadata": { "fork_of": "slimedragon.near/widget/LockLP@114929513" } } } } } }
Result:
{ "block_height": "115566048" }
No logs
Receipt:
Predecessor ID:
Receiver ID:
Gas Burned:
4 Tgas
Tokens Burned:
0 
Transferred 0.01819  to c5d8a…9b85e42174
Empty result
No logs