Skip to content

Commit

Permalink
Merge branch 'main' into tokenomics_implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik committed Jan 3, 2023
2 parents 470afdf + 5ac9153 commit 3702b49
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 30 deletions.
2 changes: 1 addition & 1 deletion packages/bridge-ui/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
const {
chains: wagmiChains,
provider,
webSocketProvider,
} = configureChains(
[mainnet, taiko],
[
Expand All @@ -83,6 +82,7 @@
);
$wagmiClient = createClient({
autoConnect: true,
provider,
connectors: [
new MetaMaskConnector({
Expand Down
10 changes: 10 additions & 0 deletions packages/bridge-ui/src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,13 @@
.dropdown-content.address-dropdown-content {
border-radius: 6px;
}

input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}

input[type=number] {
-moz-appearance: textfield;
}
6 changes: 4 additions & 2 deletions packages/bridge-ui/src/components/AddressDropdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
let addressAvatarImgData: string = "";
let tokenBalance: string = "";
onMount(async () => {
await setAddress($signer);
onMount(() => {
(async () => {
await setAddress($signer);
})();
});
$: getUserBalance($signer);
Expand Down
53 changes: 28 additions & 25 deletions packages/bridge-ui/src/components/buttons/Connect.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script lang="ts">
import { onDestroy } from "svelte";
import { BigNumber, ethers } from "ethers";
import { onDestroy, onMount } from "svelte";
import { signer } from "../../store/signer";
import { _ } from "svelte-i18n";
import {
Expand All @@ -9,7 +8,9 @@
fetchSigner,
watchAccount,
watchNetwork,
ConnectorNotFoundError
ConnectorNotFoundError,
getNetwork,
getAccount
} from "@wagmi/core";
import { CHAIN_MAINNET, CHAIN_TKO } from "../../domain/chain";
Expand Down Expand Up @@ -38,30 +39,32 @@
}
};
let unwatchNetwork;
let unwatchAccount;
async function setSigner() {
const wagmiSigner = await fetchSigner();
signer.set(wagmiSigner);
return wagmiSigner;
}
async function onConnect() {
const { chain } = getNetwork();
await setSigner();
await changeChain(chain.id);
watchNetwork(
async (network) => await changeChain(network.chain.id)
);
watchAccount(async () => {
const s = await setSigner();
transactions.set(
await $transactioner.GetAllByAddress(await s.getAddress())
);
});
}
async function connectWithConnector(connector: Connector) {
try {
const { chain } = await wagmiConnect({ connector });
await setSigner();
await changeChain(chain.id);
unwatchNetwork = watchNetwork(
async (network) => await changeChain(network.chain.id)
);
unwatchAccount = watchAccount(async () => {
const s = await setSigner();
transactions.set(
await $transactioner.GetAllByAddress(await s.getAddress())
);
});
successToast("Connected");
await wagmiConnect({ connector });
await onConnect();
successToast("Connected");
} catch(error) {
if(error instanceof ConnectorNotFoundError) {
errorToast(`${connector.name} not installed`);
Expand All @@ -77,12 +80,12 @@
"coinbase wallet": CoinbaseWallet,
};
onDestroy(() => {
if (unwatchNetwork) {
unwatchNetwork();
}
if (unwatchAccount) {
unwatchAccount();
onMount(() => {
const account = getAccount();
if(account.isConnected) {
(async () => {
await onConnect();
})();
}
});
</script>
Expand Down
5 changes: 4 additions & 1 deletion packages/bridge-ui/src/components/form/BridgeForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import FaucetModal from "../modals/FaucetModal.svelte";
let amount: string;
let amountInput: HTMLInputElement;
let requiresAllowance: boolean = true;
let btnDisabled: boolean = true;
let tokenBalance: string;
Expand Down Expand Up @@ -244,6 +245,7 @@
function useFullAmount() {
amount = tokenBalance;
amountInput.value = tokenBalance.toString();
}
function updateAmount(e: any) {
Expand Down Expand Up @@ -273,7 +275,7 @@
<button class="label-text" on:click={useFullAmount}
>{$_("bridgeForm.maxLabel")}
{tokenBalance.length > 10
? `${truncateString(tokenBalance)}...`
? `${truncateString(tokenBalance, 6)}...`
: tokenBalance}
{$token.symbol}
</button>{/if}
Expand All @@ -289,6 +291,7 @@
on:input={updateAmount}
class="input input-primary bg-dark-4 input-md md:input-lg w-full focus:ring-0"
name="amount"
bind:this={amountInput}
/>
<SelectToken />
</label>
Expand Down
5 changes: 4 additions & 1 deletion packages/website/docs/alpha-1-testnet/deploy-a-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ These steps will show you how to deploy a smart contract to Taiko A1 using Found

## Prerequisites

- Have the private key to an account that has some ETH on Taiko A1. This is to pay the small transaction fee for deploying the contract.
- Have the private key to an account that has some ETH on Taiko A1. This is to pay the small transaction fee for deploying the contract. You can check the following articles if you are unsure how to do this:
- [With MetaMask](https://www.herongyang.com/Ethereum/Ethereum-Account-Public-Private-Key-Example.html)
- [With OpenSSL](https://gist.github.com/miguelmota/3793b160992b4ea0b616497b8e5aee2f)
- [With ethereumjs-wallet](https://piyopiyo.medium.com/how-to-generate-ethereum-private-key-and-address-in-local-offline-environment-90294308593c)

## Steps

Expand Down
19 changes: 19 additions & 0 deletions packages/website/docs/alpha-1-testnet/run-a-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,22 @@ Follow the guide at [simple-taiko-node/README.md](https://github.com/taikoxyz/si
:::note
You will only be able to run a node regularly or as a proposer. In this testnet we are not running any provers.
:::

## System requirements

Because we are a fork of geth, you can consult the (geth minimum requirements)[https://github.com/ethereum/go-ethereum#hardware-requirements], which are outlined below.

### Minimum:

- CPU with 2+ cores
- 4GB RAM
- 1TB free storage space to sync the Mainnet
- (**only ~50GB for Testnet**)
- 8 MBit/sec download Internet service

### Recommended:

- Fast CPU with 4+ cores
- 16GB+ RAM
- High-performance SSD with at least 1TB of free space
- 25+ MBit/sec download Internet service
5 changes: 5 additions & 0 deletions packages/website/docs/alpha-1-testnet/use-the-bridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ Use the [bridge](https://bridge.a1.taiko.xyz/) for the following actions:

The transfer from L2 to L1 can take a while because Taiko has a several hours delay in syncing block headers to allow uncle proof generation time, and we need the synced header to match so the Merkle proof of the message being sent on L2 is valid on L1.

## Where are the HORSE contracts?

L1: https://l1explorer.a1.taiko.xyz/address/0x3E3a3416DbCc5cb4448B6b171fF15f9Da35Ab72d
L2: https://l2explorer.a1.taiko.xyz/address/0xb8ea36284d1fa062cc0c969e28a49f3531cfb1bf

## Bridge contract explained

Read the bridge documentation on our GitHub: https://github.com/taikoxyz/taiko-mono/tree/main/packages/protocol/contracts/bridge.

0 comments on commit 3702b49

Please sign in to comment.