From 22d4f4b545e6ac8e6bd11994f3ea443776db8544 Mon Sep 17 00:00:00 2001 From: kobuta23 Date: Mon, 23 Dec 2019 20:38:28 +0000 Subject: [PATCH] McDai (#10) * mcdai update --- src/App.vue | 8 +++----- src/assets/cdai.svg | 23 +++++++++++++---------- src/assets/dai.svg | 31 ++----------------------------- src/assets/sai.svg | 1 + src/components/Drawer.vue | 2 +- src/components/TokenSvg.vue | 9 ++++++--- src/featured.js | 19 +++++++++---------- src/store/index.js | 17 ++++++++++++----- 8 files changed, 47 insertions(+), 63 deletions(-) create mode 100644 src/assets/sai.svg diff --git a/src/App.vue b/src/App.vue index a060371f..5937bbc1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -42,12 +42,10 @@ - - - - - + + This website is for Multi-Collateral DAI. To redeem your SAI, visit rsai.rdai.money + + - + - - - - + + + - + @@ -18,12 +17,16 @@ - + + + + + - + - + \ No newline at end of file diff --git a/src/assets/dai.svg b/src/assets/dai.svg index 921d2c6d..9f6211cb 100644 --- a/src/assets/dai.svg +++ b/src/assets/dai.svg @@ -1,30 +1,3 @@ - - - - logo-gray_head - Created with Sketch. - - - - - - - - - - - - - - - + + diff --git a/src/assets/sai.svg b/src/assets/sai.svg new file mode 100644 index 00000000..e1350f36 --- /dev/null +++ b/src/assets/sai.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/Drawer.vue b/src/components/Drawer.vue index 58c83214..73d6b56e 100644 --- a/src/components/Drawer.vue +++ b/src/components/Drawer.vue @@ -144,7 +144,7 @@ export default { }, { symbol: "dai", - text: " DAI", + text: "DAI", loading: false } //{ symbol: 'cdai', text: 'cDAI', loading: false}, diff --git a/src/components/TokenSvg.vue b/src/components/TokenSvg.vue index 2ea1bcfc..8022486f 100644 --- a/src/components/TokenSvg.vue +++ b/src/components/TokenSvg.vue @@ -1,7 +1,7 @@ @@ -21,15 +21,18 @@ export default { size: Number }, data: () => ({ - allowed: ["rdai", "cdai", "dai", "metamask"] + allowed: ["rdai", "cdai", "dai", "sai", "metamask"] }), computed: { importedSvg() { - return this.allowed.includes(this.symbol); + return this.allowed.includes(this.symbol.toLowerCase()); }, path() { return require(`@/assets/${this.symbol.toLowerCase()}.svg`); } + }, + mounted(){ + console.log("ok so it should show the asset: " + this.symbol + " and it should be equal to: " + this.path); } }; diff --git a/src/featured.js b/src/featured.js index 11f26bb3..18ea50e0 100644 --- a/src/featured.js +++ b/src/featured.js @@ -15,8 +15,7 @@ const featured = [ colors: ["#F7997C", "#F7997C"], color: "#F7997C", hatID: { - 1: 1, - + 1: 2 //updated to rMcDai } }, { @@ -59,7 +58,7 @@ const featured = [ colors: ["#F7997C", "#0a0036"], color: "#0a0036", hatID: { - 1: 3 + 1: 4 //updated to McDai } }, { @@ -71,7 +70,7 @@ const featured = [ colors: ["#F7997C", "#2f0340"], color: "#2f0340", hatID: { - 1: 4 + 1: 5 //updated to McDai } }, { @@ -84,7 +83,7 @@ const featured = [ colors: ["#F7997C", "#f79430"], color: "#f79430", hatID: { - 1: 5 + 1: 6 //updated to McDai } }, { @@ -96,8 +95,8 @@ const featured = [ address: "0x82338B1b27cfC0C27D79c3738B748f951Ab1a7A0", colors: ["#F7997C", "#ffd200"], color: "#ffd200", - hatID: 1: { - 6 + hatID: { + 1: 7 //updated to McDAI } }, { @@ -110,7 +109,7 @@ const featured = [ colors: ["#F7997C", "#28689e"], color: "#28689e", hatID: { - 1: 7 + 1: 33000 } }, { @@ -123,7 +122,7 @@ const featured = [ colors: ["#F7997C", "#ffd200"], color: "#ffd200", hatID: { - 1: 44 + 1: 8 //updated to MCDAI } }, { @@ -136,7 +135,7 @@ const featured = [ colors: ["#F7997C", "#623089"], color: "#623089", hatID: { - 1: 57 + 1: 9 //updated to MCDAI } } ]; diff --git a/src/store/index.js b/src/store/index.js index 5820068d..74d72f3c 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -15,9 +15,9 @@ const SELF_HAT_ID = MAX_UINT256; const HARDCODED_CHAIN = 1; const TOKENS = { 1: { - dai: "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359", - cdai: "0xf5dce57282a584d2746faf1593d3121fcac444dc", - rdai: "0xea8b224eDD3e342DEb514C4176c2E72Bcce6fFF9" + dai: "0x6b175474e89094c44da98b954eedeac495271d0f", + cdai: "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", + rdai: "0x261b45D85cCFeAbb11F022eBa346ee8D1cd488c0" // UPDATED to rMCDAI legacy was "0xea8b224eDD3e342DEb514C4176c2E72Bcce6fFF9" }, 3: { cdai: "0x2b536482a01e620ee111747f8334b395a42a555e" @@ -395,7 +395,7 @@ export default new Vuex.Store({ async getExchangeRate({ commit }) { const rate = await ( await fetch( - "https://api.compound.finance/api/v2/ctoken?addresses[]=0xf5dce57282a584d2746faf1593d3121fcac444dc" + "https://api.compound.finance/api/v2/ctoken?addresses[]=0x5d3a536e4d6dbd6114cc1ead35777bab948e3643" //updated to McDai ) ).json(); commit("SETEXCHANGERATE", parseFloat(rate.cToken[0].supply_rate.value)); @@ -483,10 +483,17 @@ export default new Vuex.Store({ address: state.account.address }) .then(r => { + const featuredMatch = { + ...featured.filter( + i => i.hatID[state.account.chainId] === r.hatID + )[0] + }; const newHat = { ...r, - ...featured.filter(i => i.hatID[state.account.chainId] === r.hatID)[0] + ...featuredMatch }; + if (featuredMatch.hasOwnProperty("hatID")) + newHat.hatID = featuredMatch.hatID[state.account.chainId]; commit("SETUSERHAT", newHat); commit("SETINTERFACEHAT", newHat); return resolve(true);