diff --git a/index.html b/index.html index ef36d82..d7afbbc 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,6 @@ - @@ -168,4 +165,4 @@ - + \ No newline at end of file diff --git a/manifest.json b/manifest.json index 19ef72e..86859bc 100644 --- a/manifest.json +++ b/manifest.json @@ -1,5 +1,5 @@ { - "name" : "kakapay", + "name" : "ippswap-finance", "appid" : "__UNI__0088A51", "description" : "", "versionName" : "1.0.0", @@ -85,12 +85,15 @@ } } }, - "title" : "kakapay", + "title" : "ippswap-finance", "optimization" : { "treeShaking" : { "enable" : true } }, - "template" : "index.html" + "template" : "index.html", + "router" : { + "mode" : "history" + } } } diff --git a/pages.json b/pages.json index 164e115..c760bd9 100644 --- a/pages.json +++ b/pages.json @@ -6,7 +6,7 @@ { "path": "pages/index/index", "style": { - "navigationBarTitleText": "" + "navigationBarTitleText": "ippswap-finance" // "enablePullDownRefresh": true } } diff --git a/pages/index/index.vue b/pages/index/index.vue index 0387eec..085903c 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -42,8 +42,9 @@ {{ i18n.link }} - - https://ippswap.com/community?inviteCode={{form.address}} + + + {{url}} @@ -57,15 +58,16 @@ import { web3x } from "@/utils/web3x/web3x.js" - - const ipptAddress = '0x622d7b79a904e00e5fcab06396ff009e441f0186' - + + const ipptAddress = '0x622d7b79a904e00e5fcab06396ff009e441f0186' + export default { components: { GeneralButton, }, data() { return { + url: '', form: { address: '', contract: '0x6b175474e89094c44da98b954eedeac495271d0f', @@ -85,8 +87,11 @@ }, onLoad(val) { - if (val) { + this.url = location.origin + '?inviteCode='; + if (val.inviteCode) { this.form.supAddress = val.inviteCode + } else { + this.form.supAddress = '0x622d7b79a904e00e5fcab06396ff009e441f0186' } this.init() }, @@ -96,12 +101,25 @@ // 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕 onReady() {}, methods: { + // 点击复制按钮 + onCopy(v) { + uni.setClipboardData({ + data: v, + success: () => { + uni.showToast({ + title: 'success', + icon: 'none', + }) + } + }) + }, init() { web3x.connectViaInPage() .then(res => { this.form.address = web3x.selectedAddress // 当前钱包地址 - console.log("当前钱包地址", web3x.selectedAddress); + // console.log("当前钱包地址", web3x.selectedAddress); + this.url = location.origin + '?inviteCode=' + web3x.selectedAddress }) }, submit() { @@ -116,46 +134,60 @@ mask: true }) // 当前钱包地址 - console.log("当前钱包地址", web3x.selectedAddress); - // 检查 USDT 授权给 IPPT 的数量 - const allowance = await web3x.usdt.$allowance(web3x.selectedAddress, ipptAddress) - - // 如果 allowance 大于某个值则不需要重新授权. 示例为 1000000 USDT - if (allowance > Number(1000000) * 10 ** Number(18)) { - web3x.ippt.$creatCode(this.form.supAddress, web3x.selectedAddress) - uni.hideLoading() - } else { - // 否则则需要重新授权为 0, 然后在进行极限授权 - // 提示最小需授权 XXX USDT, 请取消授权后重新授权 - - // 取消授权 - web3x.usdt.$approve(ipptAddress, 0) - .on("receipt", () => { - console.log("取消授权完成") - // 然后在进行极限授权 - web3x.usdt.approveMAX(ipptAddress) - .on("transactionHash", () => { - console.log("调用极限授权") - - // 调用IPPT 合约绑定上级关系 - // 0xFb4FC7Ddb8c4aa6b944703CE1e89D2B9Aa67a400: 上级地址 - // web3x.selectedAddress: 当前钱包地址 - web3x.ippt.$creatCode(this.form.supAddress, web3x.selectedAddress) - uni.hideLoading() - }) - }) - } - + // console.log("当前钱包地址", web3x.selectedAddress); + // 检查 USDT 授权给 IPPT 的数量 + const allowance = await web3x.usdt.$allowance(web3x.selectedAddress, ipptAddress) + // console.log(allowance, '当前用户授权给ippt的数量') + // 如果 allowance 大于某个值则不需要重新授权. 示例为 1000000 USDT + if (allowance > Number(1000000) * 10 ** Number(18)) { + web3x.ippt.$creatCode(this.form.supAddress, web3x.selectedAddress) + uni.hideLoading() + } else { + // 否则则需要重新授权为 0, 然后在进行极限授权 + // 提示最小需授权 XXX USDT, 请取消授权后重新授权 + // 取消授权 + if (allowance == 0) { + // 然后在进行极限授权 + web3x.usdt.approveMAX(ipptAddress) + .on("transactionHash", () => { + // console.log("调用极限授权") + // 调用IPPT 合约绑定上级关系 + // 0xFb4FC7Ddb8c4aa6b944703CE1e89D2B9Aa67a400: 上级地址 + // web3x.selectedAddress: 当前钱包地址 + web3x.ippt.$creatCode(this.form.supAddress, web3x + .selectedAddress) + uni.hideLoading() + }) + } else { + web3x.usdt.$approve(ipptAddress, 0) + .on("receipt", () => { + // console.log("取消授权完成") + // 然后在进行极限授权 + web3x.usdt.approveMAX(ipptAddress) + .on("transactionHash", () => { + // console.log("调用极限授权") + // 调用IPPT 合约绑定上级关系 + // 0xFb4FC7Ddb8c4aa6b944703CE1e89D2B9Aa67a400: 上级地址 + // web3x.selectedAddress: 当前钱包地址 + web3x.ippt.$creatCode(this.form.supAddress, web3x + .selectedAddress) + uni.hideLoading() + }) + }) + } + + } + // 授权当前钱包的 USDT 给 IPPT (参数为 IPPT 合约地址) // web3x.usdt.approveMAX("0x622d7b79a904e00e5fcab06396ff009e441f0186") - // .on("transactionHash", async (receipt) => { - // console.log("transactionHash", receipt) - // // 调用IPPT 合约绑定上级关系 - // // 0xFb4FC7Ddb8c4aa6b944703CE1e89D2B9Aa67a400: 上级地址 - // // web3x.selectedAddress: 当前钱包地址 - // await web3x.ippt.$creatCode(this.form.supAddress, web3x.selectedAddress) - // uni.hideLoading() - // }) + // .on("transactionHash", async (receipt) => { + // console.log("transactionHash", receipt) + // // 调用IPPT 合约绑定上级关系 + // // 0xFb4FC7Ddb8c4aa6b944703CE1e89D2B9Aa67a400: 上级地址 + // // web3x.selectedAddress: 当前钱包地址 + // await web3x.ippt.$creatCode(this.form.supAddress, web3x.selectedAddress) + // uni.hideLoading() + // }) }) }, go(val) { diff --git a/static/images/logo2.png b/static/images/logo2.png new file mode 100644 index 0000000..128cad7 Binary files /dev/null and b/static/images/logo2.png differ diff --git a/utils/language/zh_TW.js b/utils/language/zh_TW.js index 490bdb0..0742a00 100644 --- a/utils/language/zh_TW.js +++ b/utils/language/zh_TW.js @@ -2,7 +2,7 @@ export default { tabBar: { Home: '尊敬的ippswap基金會會員:', - contract: '映射智慧合約', + contract: '映射智能合約', address: '我的邀請人地址', confirm: '確認', link: '我的邀請連結', diff --git a/utils/web3x/web3x.js b/utils/web3x/web3x.js index b8583f0..7de77d8 100644 --- a/utils/web3x/web3x.js +++ b/utils/web3x/web3x.js @@ -413,6 +413,6 @@ export const web3x = new Web3X( // BSC链Id是56 // ippt 合约 "0x622d7b79a904e00e5fcab06396ff009e441f0186", - // usdt 合约 - "0x0a70dDf7cDBa3E8b6277C9DDcAf2185e8B6f539f" + // usdt 合约 0x0a70dDf7cDBa3E8b6277C9DDcAf2185e8B6f539f + "0x55d398326f99059fF775485246999027B3197955" );