Skip to content

Commit

Permalink
Merge main into dev branch 6 (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrwbabylonlab authored Aug 19, 2024
2 parents 9f5aab4 + f0aed99 commit aaf6d62
Show file tree
Hide file tree
Showing 11 changed files with 125 additions and 24 deletions.
86 changes: 78 additions & 8 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,84 @@ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.

Parameters

Licensor: Babylon Labs, Ltd.

Licensed Work: simple-staking
The Licensed Work is (c) 2024 Babylon Labs, Ltd.

Additional Use Grant: None.

Change Date: 2027-05-15 (March 15th, 2027]
Licensor: Babylon Labs Ltd.

Licensed Work: Simple Staking
The Licensed Work is (c) 2024 Babylon Labs Ltd.

Additional Use Grant:

In addition to the uses permitted under the non-production license below,
we grant you a limited, non-exclusive, non-transferable, non-sublicensable,
revocable license, limited as set forth below, to use the Licensed Work
in this repository for production commercial uses built on or using and integrated
with the Babylon Protocol, not including Competing Uses.

Any use beyond the scope of this license, including uses that are not built on or
using and integrated with the Babylon Protocol, or are Competing Uses,
will terminate this license to you, automatically and without notice.

This License applies separately and solely to the specific versions of the Licensed Work
in the specified repository on or before the date of this License, and we may require a
different license and different provisions for each subsequent version of the
Licensed Work released by us.

"Babylon Labs", "we", "our", or "us" means Babylon Labs Ltd.

"Babylon Protocol" means the Bitcoin staking protocol as further described in the documentation
here (https://docs.babylonlabs.io/docs/introduction/babylon-overview), as updated from time to time.

"Competing Use" means any use of the Licensed Work in any product, software, protocol, network,
application, or service that is made available to any party and that
(i) substitutes for the use of the Babylon Protocol,
(ii) offers the same or substantially similar functionality as the Babylon Protocol or
(iii) is built on or uses a protocol with substantially similar functionality as the Babylon Protocol
or otherwise facilitates the staking of bitcoin other than by utilizing the Babylon Protocol.

The provisions in this License apply to each individual, entity, group, or association
(each and collectively, "you" or "your") who uses the Licensed Work for production,
and you agree to such provisions. Your production use of the Licensed Work is conditional on your
agreement to this License. If you do not agree and consent to be bound to this License,
do not so use the Software.

If you do not fall within the limited scope of this license as described above or below,
or are otherwise not in strict compliance with this License, then this production license does not
extend to you and does not grant you any production use, including any copying, distributing, or
making any derivative use of the Licensed Work for production purposes.

Limited Scope of License. Your commercial production license to the Licensed Work
under this License does not extend to any use:

1. unless you have legal capacity to consent and agree to be bound by this License;
2. unless you have the technical knowledge necessary or advisable to understand and evaluate the
risks of using the Licensed Work and the Babylon Protocol;
3. if you are a resident or agent of, or an entity organized, incorporated or doing business in,
Afghanistan, Belarus, Bosnia and Herzegovina, Burundi, Central African Republic, Crimea, Cuba,
Democratic People's Republic of Korea, Democratic Republic of the Congo,
Donetsk or Luhansk Regions of Ukraine, Eritrea, Guinea, Guinea-Bissau, Haiti, Iran, Iraq, Lebanon,
Libya, Mali, Myanmar, Nicaragua, Russia, Somalia, South Sudan, Sudan, Syria, Venezuela, Yemen,
or Zimbabwe or any other country to which the United States, the United Kingdom,
the European Union or any of its member states or the United Nations or any of its member states
(collectively, the "Major Jurisdictions") embargoes goods or imposes sanctions
(such embargoed or sanctioned territories, collectively, the "Restricted Territories");
4. if you are, or if you directly or indirectly own or control, from any person or entity that is
listed on any sanctions list or equivalent maintained by any of the Major Jurisdictions
(collectively, "Sanctions Lists Persons");
5. to transact in or with any Restricted Territories or Sanctions List Persons;
6. if you are a U.S. Person as defined in 17 CFR § 230.902, or currently or ordinarily located or
resident in (or incorporated or organized in) the United States of America, Canada, or
Australia (collectively, "Excluded Jurisdictions"), or to transact in or with Excluded Jurisdictions;
7. to defraud, or otherwise materially mislead, any person;
8. in violation of applicable laws, rules or regulations in your relevant jurisdiction;
9. that circumvents any sanctions or export controls targeting you or the country or territory where
you are located; or
10. in any activity that transmits, exchanges, or is otherwise supported by the direct or indirect
proceeds of criminal or fraudulent activity.

Any production use of the Licensed Work by you confirms your agreement to the foregoing limitations,
and your understanding and agreement that they are limitations and not restrictions.

Change Date: 2027-03-15 (March 15th, 2027)

Change License: Apache 2.0

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-staking",
"version": "0.2.33",
"version": "0.2.36",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const iconLinks = [
},
{
name: "Medium",
url: "https://medium.com/babylonchain-io",
url: "https://medium.com/babylonlabs-io",
Icon: BsMedium,
},
{
Expand Down
4 changes: 3 additions & 1 deletion src/app/components/Modals/ConnectModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ export const ConnectModal: React.FC<ConnectModalProps> = ({
};

const buildInjectableWallet = (shouldDisplay: boolean, name: string) => {
if (!shouldDisplay) {
// NOTE: The 'OneKey (Browser)' special case here is a temporary solution
// while waiting for the OneKey wallet to release their fixes
if (!shouldDisplay || injectedWalletProviderName === "OneKey (Browser)") {
return null;
}

Expand Down
16 changes: 13 additions & 3 deletions src/app/components/Modals/PreviewModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface PreviewModalProps {
feeRate: number;
unbondingTimeBlocks: number;
confirmationDepth: number;
unbondingFeeSat: number;
}

export const PreviewModal: React.FC<PreviewModalProps> = ({
Expand All @@ -31,6 +32,7 @@ export const PreviewModal: React.FC<PreviewModalProps> = ({
stakingFeeSat,
feeRate,
confirmationDepth,
unbondingFeeSat,
}) => {
const cardStyles =
"card border bg-base-300 p-4 text-sm dark:border-0 dark:bg-base-200";
Expand Down Expand Up @@ -76,7 +78,7 @@ export const PreviewModal: React.FC<PreviewModalProps> = ({
<p className="text-xs dark:text-neutral-content">Term</p>
<p>{blocksToDisplayTime(stakingTimeBlocks)}</p>
</div>
<div className={`${cardStyles} basis-4/5`}>
<div className={`${cardStyles} basis-3/5`}>
<p className="text-xs dark:text-neutral-content">
On-demand unbonding
</p>
Expand All @@ -85,12 +87,20 @@ export const PreviewModal: React.FC<PreviewModalProps> = ({
time)
</p>
</div>
<div className={`${cardStyles} basis-1/5`}>
<p className="text-xs dark:text-neutral-content">Unbonding fee</p>
<p>{`${maxDecimals(satoshiToBtc(unbondingFeeSat), 8)} ${coinName}`}</p>
</div>
</div>
<h4 className="text-center text-base">Attention!</h4>
<p className="dark:text-neutral-content">
1. Your stake may &quot;overflow&quot; the staking TVL cap and need to
be unbonded and withdrawn, which will cost you extra transaction fees.
So please stake wisely.
be unbonded and withdrawn, which will cost you {coinName} transaction
fees. So please stake wisely. Unbonding will cost you a static
transaction fee of{" "}
<strong>{`${maxDecimals(satoshiToBtc(unbondingFeeSat), 8)} ${coinName}`}</strong>
, while the withdrawal fee depends on network conditions. All fees go
to the {coinName} miners.
</p>
<p className="dark:text-neutral-content">
2. No third party possesses your staked {coinName}. You are the only
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ export const FinalityProviders: React.FC<FinalityProvidersProps> = ({

return (
<>
<p>Select a finality provider.</p>
<p>
<strong>Step-1:</strong> Select a finaltiy provider
</p>
<div className="flex gap-3">
<FinalityProviderSearch onSearch={handleSearch} />
</div>
Expand Down
3 changes: 1 addition & 2 deletions src/app/components/Staking/Form/StakingAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export const StakingAmount: React.FC<StakingAmountProps> = ({
} else {
setError("");
onStakingAmountSatChange(satoshis);
setValue(maxDecimals(satoshiToBtc(satoshis), 8).toString());
}
}, [
btcWalletBalanceSat,
Expand Down Expand Up @@ -126,7 +125,7 @@ export const StakingAmount: React.FC<StakingAmountProps> = ({
</div>
<input
type="string"
className={`no-focus input input-bordered w-full ${error && "input-error"}`}
className={`no-focus input input-bordered w-full ${error ? "input-error" : ""}`}
value={value}
onChange={handleChange}
onBlur={handleBlur}
Expand Down
6 changes: 5 additions & 1 deletion src/app/components/Staking/Staking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ export const Staking: React.FC<StakingProps> = ({
maxStakingTimeBlocks,
unbondingTime,
confirmationDepth,
unbondingFeeSat,
} = stakingParams;

// Staking time is fixed
Expand Down Expand Up @@ -604,7 +605,9 @@ export const Staking: React.FC<StakingProps> = ({

return (
<>
<p>Set up staking terms</p>
<p>
<strong>Step-2:</strong> Set up staking terms
</p>
<div className="flex flex-1 flex-col">
<div className="flex flex-1 flex-col">
<StakingTime
Expand Down Expand Up @@ -659,6 +662,7 @@ export const Staking: React.FC<StakingProps> = ({
confirmationDepth={confirmationDepth}
feeRate={feeRate}
unbondingTimeBlocks={unbondingTime}
unbondingFeeSat={unbondingFeeSat}
/>
)}
</div>
Expand Down
20 changes: 17 additions & 3 deletions src/app/components/Summary/Summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,22 @@ export const Summary: React.FC<SummaryProps> = ({
</div>
</div>
<div className="divider divider-horizontal xl:m-0" />
<div className="flex flex-col gap-1 text-sm xl:flex-1 xl:flex-row xl:items-center xl:justify-center xl:gap-2 xl:text-base">
<p className="dark:text-neutral-content">Balance</p>
<div className="flex flex-col gap-1 text-sm xl:flex-1 xl:flex-row xl:items-center xl:justify-center xl:gap-2">
<div className="flex items-center justify-end gap-1">
<p className="dark:text-neutral-content">Stakable Balance</p>
<span
className="cursor-pointer text-xs"
data-tooltip-id={"tooltip-stakeable-balance"}
data-tooltip-content={`Stakable balance only includes confirmed Bitcoin balance.
It does not include balance stemming from pending transactions.`}
>
<AiOutlineInfoCircle />
</span>
<Tooltip
id={"tooltip-stakeable-balance"}
className="tooltip-wrap"
/>
</div>
<div className="flex items-center gap-1">
<FaBitcoin className="text-primary" size={16} />
{typeof btcWalletBalanceSat === "number" ? (
Expand All @@ -90,7 +104,7 @@ export const Summary: React.FC<SummaryProps> = ({
href="https://discord.com/invite/babylonglobal"
target="_blank"
rel="noopener noreferrer"
className="font-light text-primary hover:underline text-right lg:text-left"
className="font-light text-primary hover:underline text-right"
>
Get Test Tokens
</a>
Expand Down
2 changes: 1 addition & 1 deletion src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ export const shouldDisplayTestingMsg = (): boolean => {
export const getNetworkAppUrl = (): string => {
return shouldDisplayTestingMsg()
? "https://btcstaking.testnet.babylonchain.io"
: "https://btcstaking.babylonchain.io";
: "https://btcstaking.babylonlabs.io";
};

0 comments on commit aaf6d62

Please sign in to comment.