Skip to content

Commit

Permalink
Merge branch 'development' into responsive
Browse files Browse the repository at this point in the history
  • Loading branch information
hydroxylase authored Sep 22, 2024
2 parents a35fbd6 + 63ec983 commit 476d159
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 82 deletions.
149 changes: 149 additions & 0 deletions .github/.ubiquibot-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
plugins:
- uses:
- plugin: https://ubiquibot-command-wallet-development.ubiquity.workers.dev
- uses:
- plugin: https://ubiquibot-command-query-user-development.ubiquity.workers.dev
with:
allowPublicQuery: true
- uses:
- plugin: https://ubiquibot-assistive-pricing-development.ubiquity.workers.dev
with:
labels:
time:
- "Time: <1 Hour"
- "Time: <2 Hours"
- "Time: <4 Hours"
- "Time: <1 Day"
- "Time: <1 Week"
- "Time: <1 Month"
priority:
- "Priority: 1 (Normal)"
- "Priority: 2 (Medium)"
- "Priority: 3 (High)"
- "Priority: 4 (Urgent)"
- "Priority: 5 (Emergency)"
basePriceMultiplier: 2
publicAccessControl:
setLabel: true
fundExternalClosedIssue: false
- skipBotEvents: false
uses:
- plugin: ubiquibot/conversation-rewards@development
# we don't skip bot events so conversation rewards triggered by the bot also run
with:
evmNetworkId: 100
evmPrivateEncrypted: "bd5AFnSCO6c5jJyPifpOfr5Zys29RE7SyXkEU3akT13RtGmYDrqGIGuvJQyH53HA5dIba7PL5bXfll0JebmwXYe5gHIXSGX80WuGMDHh0cFfeGjHhmUXe8kkZ1OT2De9qRpqejJcEzdfi-8XNAvP7cQu2Vt-7RNnPw" # https://github.com/ubiquibot/conversation-rewards/pull/111#issuecomment-2348639931
erc20RewardToken: "0xC6ed4f520f6A4e4DC27273509239b7F8A68d2068"
incentives:
contentEvaluator:
enabled: true
userExtractor:
enabled: true
redeemTask: true
dataPurge:
enabled: true
formattingEvaluator:
multipliers:
- role: [ ISSUE_SPECIFICATION ]
multiplier: 3
rewards:
regex:
"\\b\\w+\\b": 0.1
html:
br: 0
code: 5
p: 1
em: 0
img: 5
strong: 0
blockquote: 0
h1: 1
h2: 1
h3: 1
h4: 1
h5: 1
h6: 1
a: 5
li: 1
td: 1
hr: 0
- role: [ ISSUE_AUTHOR ]
multiplier: 1
rewards:
regex:
"\\b\\w+\\b": 0.2
- role: [ ISSUE_ASSIGNEE ]
multiplier: 1
rewards:
regex:
"\\b\\w+\\b": 0.1
- role: [ ISSUE_COLLABORATOR ]
multiplier: 1
rewards:
regex:
"\\b\\w+\\b": 0.1
- role: [ ISSUE_CONTRIBUTOR ]
multiplier: 0.25
rewards:
regex:
"\\b\\w+\\b": 0.1
- role: [ PULL_SPECIFICATION ]
multiplier: 0
rewards:
regex:
"\\b\\w+\\b": 0
- role: [ PULL_AUTHOR ]
multiplier: 0
rewards:
regex:
"\\b\\w+\\b": 0.2
- role: [ PULL_ASSIGNEE ]
multiplier: 1
rewards:
regex:
"\\b\\w+\\b": 0.1
- role: [ PULL_COLLABORATOR ]
multiplier: 1
rewards:
regex:
"\\b\\w+\\b": 0.1
- role: [ PULL_CONTRIBUTOR ]
multiplier: 0.25
rewards:
regex:
"\\b\\w+\\b": 0.1
permitGeneration:
enabled: true
githubComment:
post: true
debug: false
- uses:
- plugin: ubiquibot/user-activity-watcher@development
with:
watch:
optOut:
- ubiquibot
- launch-party
- staging
- production
- uses:
- plugin: ubiquibot/automated-merging@development
with:
approvalsRequired:
collaborator: 1
mergeTimeout:
collaborator: "3.5 days"
repos:
ignore:
- ubiquibot
- launch-party
- staging
- production
- uses:
- plugin: https://ubiquibot-command-start-stop-development.ubiquity.workers.dev
with:
reviewDelayTolerance: "3 Days"
taskStaleTimeoutDuration: "30 Days"
startRequiresWallet: true # default is true
- uses:
- plugin: ubiquibot/issue-comment-embeddings@development
25 changes: 1 addition & 24 deletions static/scripts/rewards/cirip/ens-lookup.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { ethers } from "ethers";
import abi from "../abis/cirip.json";
import { fetchEns } from "./fetch-ens";
import { queryReverseEns } from "./query-reverse-ens";

export const reverseEnsInterface = new ethers.utils.Interface(abi);

// addEventListener("fetch", event => {
// event.respondWith(handleRequest(event.request).catch(err => new Response(err.stack, { status: 500 })));
// });
Expand All @@ -24,30 +19,12 @@ export async function ensLookup(addr: string, networkId: number) {
// let response = "";
try {
reverseRecord = await queryReverseEns(address, networkId);
const responseParsed = JSON.parse(reverseRecord).result;
const _reverseRecord = ethers.utils.defaultAbiCoder.decode([ethers.utils.ParamType.from("string[]")], responseParsed);
reverseRecord = _reverseRecord[0][0];
} catch (e) {
console.error(e);
// throw "Error contacting ethereum node. \nCause: '" + e + "'. \nResponse: " + response;
}

const allDomains = await fetchEns(address);

if (reverseRecord == "") {
reverseRecord = null;
}

// if reverse record is set, validate addr owns this domain.
if (reverseRecord != null && !allDomains.includes(reverseRecord)) {
console.warn("Failed to validate! Reverse record set to " + reverseRecord + ", but user does not own this name.");
reverseRecord = null;
}

return {
reverseRecord: reverseRecord,
domains: allDomains,
};
return reverseRecord;
// new Response(JSON.stringify(response), {
// headers: {
// "Content-Type": "application/json;charset=UTF-8",
Expand Down
12 changes: 0 additions & 12 deletions static/scripts/rewards/cirip/fetch-ens.ts

This file was deleted.

12 changes: 0 additions & 12 deletions static/scripts/rewards/cirip/query-graph.ts

This file was deleted.

27 changes: 8 additions & 19 deletions static/scripts/rewards/cirip/query-reverse-ens.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { app } from "../app-state";
import { useRpcHandler } from "../web3/use-rpc-handler";
import { reverseEnsInterface } from "./ens-lookup";
import { ethers } from "ethers";

const mainnetRpcUrl = "https://eth.drpc.org";

export async function queryReverseEns(address: string, networkId: number) {
// Try to get the ENS name from localStorage
Expand All @@ -12,33 +14,20 @@ export async function queryReverseEns(address: string, networkId: number) {
if (cachedEnsName) return cachedEnsName;
}

if (cachedEnsName) {
// Let's drop the old cache.
if (cachedEnsName && !cachedEnsName.trim().startsWith("{")) {
// If the ENS name is in localStorage, return it
return cachedEnsName;
} else {
// If the ENS name is not in localStorage, fetch it from the API
const data = reverseEnsInterface.encodeFunctionData("getNames", [[address.substring(2)]]);

const response = await fetch(endpoint, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: "1",
method: "eth_call",
params: [{ to: "0x3671aE578E63FdF66ad4F3E12CC0c0d71Ac7510C", data: data }, "latest"],
}),
});
const web3Provider = new ethers.providers.JsonRpcProvider(mainnetRpcUrl);
const ensName = await web3Provider.lookupAddress(address);

if (!response.ok) {
if (ensName === null) {
console.error("ENS lookup failed: API request failed");
return "";
}

const ensName = await response.text();

// Store the ENS name in localStorage for future use
localStorage.setItem(address, ensName);

Expand Down
11 changes: 1 addition & 10 deletions static/scripts/rewards/render-transaction/render-ens-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,7 @@ type EnsParams =
export async function renderEnsName({ element, address, tokenAddress, tokenView, networkId }: EnsParams): Promise<void> {
let href: string = "";
try {
const resolved = await ensLookup(address, networkId);
let ensName: undefined | string;
if (resolved.reverseRecord) {
ensName = resolved.reverseRecord;
} else if (resolved.domains.length) {
const domain = resolved.domains.shift();
if (domain) {
ensName = domain;
}
}
const ensName = await ensLookup(address, networkId);
if (ensName) {
if (tokenView) {
href = `${app.currentExplorerUrl}/token/${tokenAddress}?a=${address}`;
Expand Down
4 changes: 2 additions & 2 deletions static/styles/rewards/media-queries.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ header span:first-child::after {
/* Landscape */
@media screen and (orientation: landscape) {
body {
width: 100vw; /* 100% of viewport width */
max-width: 100vw; /* prevents any overflow issues */
width: 100%; /* 100% of viewport width */
max-width: 100%; /* prevents any overflow issues */
overflow-x: hidden; /* prevents horizontal scrolling */
padding-left: env(safe-area-inset-left);
padding-right: env(safe-area-inset-right);
Expand Down
18 changes: 15 additions & 3 deletions static/styles/rewards/pay.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,38 @@
box-sizing: border-box;
}

html {
display:block;
width: 100%;
height: 100%;
}

body, main {
width: 100%;
height: 100%;
}

a {
color: #808080;
}

body {
/* min-height: 100vh; */
/* height: calc(100 * var(--vh)); */
overflow: hidden;
}

body,
main {
max-width: 100vw;
max-width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}

main {
width: 100vw;
width: 100%;
position: relative;
}

Expand Down Expand Up @@ -136,7 +148,7 @@ header a:hover #logo {
main {
display: flex;
flex-direction: column;
height: 100vh; /* adjust this according to your needs */
height: 100%; /* adjust this according to your needs */
}

header {
Expand Down

0 comments on commit 476d159

Please sign in to comment.