Skip to content

Commit

Permalink
Feature/v2 (#34)
Browse files Browse the repository at this point in the history
* update v1 artifacts

* v2 contracts and tests

* bump base record allowance

* tests for divide p2sh32, bump fulcrum max conn

* run tests out of band, update divide cli addr

* bump min fees

* slow tests, fix cspell

* re multi-thred tests

* remove sleep in tests

* bump default broadcast version

* simplify forms, fix mempool broadcast query

* revamp docs forms

* fix terminus behavior, add bitauth links

* fix estimator bug

* debounc bitauth link

* add bitauth json files

* minor fixes

* verbage

* optimize return locks

* update graphic, add back create tab

* update graphic, add back create tab

* fix qr blockie

* fix header and intro

* update verbage

* disclosure, faq, warning, fix comments

---------

Co-authored-by: 2qx <2qx.git@small.neomailbox.ch>
  • Loading branch information
2qx and 2qx authored Aug 31, 2023
1 parent df5267b commit fe07bf2
Show file tree
Hide file tree
Showing 19 changed files with 433 additions and 42 deletions.
42 changes: 26 additions & 16 deletions packages/app/src/lib/Contract.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -69,26 +69,29 @@
});
}
const throttleUpdate = throttle(3000, async () => {
await updateBalance();
},{ noLeading: true, noTrailing: false });
const throttleUpdate = throttle(
3000,
async () => {
await updateBalance();
},
{ noLeading: true, noTrailing: false }
);
beforeUpdate(async () => {
// This fixes a bug related to the contract switch where old contracts appear
if (instanceType && instanceType !== instance.artifact.contractName) instance = undefined;
await throttleUpdate();
});
const updateBalance = async () => {
if (instance) balance = await instance.getBalance();
isFunded = balance > 0 ? true : false;
if (bitauth.length==0) {
try{
bitauth = await instance.execute(undefined, undefined, undefined, true);
}catch (e){
// pass
}
if (bitauth.length == 0) {
try {
bitauth = await instance.execute(undefined, undefined, undefined, true);
} catch (e) {
// pass
}
}
if (instance.contract.name === 'Annuity' || instance.contract.name === 'Perpetuity') {
if (showSeries) {
Expand Down Expand Up @@ -163,6 +166,7 @@
<br />
<AddressBlockie lockingBytecode={instance.getLockingBytecode()} />
</span>

<div>
<span style="position: relative; display: inline-block; padding: 1em 1em 0 0;">
<div style="font-size: x-large;">{instance.artifact.contractName}</div>
Expand Down Expand Up @@ -206,19 +210,25 @@
</IconButton>
<Tooltip>Open permanent link in new tab</Tooltip>
</Wrapper>

<Wrapper>
<AddressQrDialog codeValue={instance.getAddress()} lockingBytecode={instance.getLockingBytecode()} />
<Tooltip>Show qr code</Tooltip>
</Wrapper>
{#if instance.options.version >= 2}
<Wrapper>
<AddressQrDialog
codeValue={instance.getAddress()}
lockingBytecode={instance.getLockingBytecode()}
/>
<Tooltip>Show qr code</Tooltip>
</Wrapper>
{/if}

<SickPigAddress address={instance.getAddress()} network={nodeValue} />
{#if nodeValue === 'mainnet'}
<BlockchairAddress address={instance.getAddress()} />
<BitInfoChartsAddress {instance} />
{/if}
</div>

{#if instance.options.version < 2}
<b>Sending new funds to old contracts (v0 and v1) may result in loss of funds. Use a new contract (v2) for new funds.</b>
{/if}
<Address address={instance.getAddress()} />

{#if utxos.length == 0}
Expand Down
9 changes: 4 additions & 5 deletions packages/app/src/lib/forms/AnnuityForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Annuity, DUST_UTXO_THRESHOLD, sanitizeAddress } from '@unspent/phi';
import Textfield from '@smui/textfield';
import HelperText from '@smui/textfield/helper-text';
import Button from '@smui/button';
import Button from '@smui/button';
import Radio from '@smui/radio';
import FormField from '@smui/form-field';
Expand All @@ -15,7 +15,7 @@
let options = { network: network, version: version };
let isPublished = false;
let showWarning = true;
let showWarning = true;
let showHelp = true;
Expand Down Expand Up @@ -49,7 +49,7 @@
async function createContract() {
if (receiptAddress && installment && period) {
try {
try {
try {
receiptAddress = await sanitizeAddress(receiptAddress);
} catch (e: any) {
if (e.message) {
Expand All @@ -73,8 +73,7 @@

<div class="margins">
<p>
An annuity contract may send a fixed amount to a predefined address on a
regular schedule.
An annuity contract allows sending a fixed amount to a predefined address on a regular schedule.
</p>
{#if showWarning}
<ul>
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/lib/forms/DivideForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

<div class="margins">
<p>
A divide contract splits any coins sent to it across multiple addresses.
A divide contract allows splitting any coins sent to it across multiple addresses.
</p>
{#each payees as payee, i}
<AddressOptional
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/lib/forms/FaucetForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

<div class="margins">
<p>
A faucet contract pays some amount to anyone after the period has elapsed.
A faucet contract allows paying some amount to anyone after the period has elapsed.
</p>

<Textfield
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/lib/forms/MineForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
required
label="Payout (satoshis)"
>
<HelperText slot="helper">Amount contract will payout per period.</HelperText>
<HelperText slot="helper">Amount contract allows paying per period.</HelperText>
</Textfield>

<Textfield
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/lib/forms/PerpetuityForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@

<div class="margins">
<p>
A perpetuity contract will send a fixed fraction of total value to a predefined address on a
A perpetuity contract allows sending a fixed fraction of total value to a predefined address on a
regular schedule.
</p>
{#if showWarning}
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,5 @@
main {
background-color: rgba(244, 244, 244, 0.2);
}
</style>
4 changes: 2 additions & 2 deletions packages/app/src/routes/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ layout: splash

> **Get money, don't spend all of it.**
The goal of this app is to let anyone in the world save money for regular distribution over a long period of time. The core feature is a trustless irrevocable contract that anyone can customize, publish and fund themselves.
This app is for saving money for regular distribution over a long period of time. The core feature is a trustless irrevocable contract that anyone can customize, publish and fund themselves.

There are no fiat prices, no markets. Nothing is traded. All contracts are single party. Contracts do not co-mingle funds, nor do they rely on outside data. The contract exists on the base layer of the Bitcoin Cash blockchain, and can continue to function without this webpage. The contract exists on the base layer of the Bitcoin Cash blockchain, and can continue to function without this webpage.
There are no fiat prices, no markets. Nothing is traded. All contracts are single party. Contracts do not co-mingle funds, nor do they rely on outside data. Contracts exist on the base layer of the Bitcoin Cash blockchain, and can continue to function without this webpage.

Anyone can put their own money on a contract they created and get the same money back over time. This app allows anyone to do the math to calculate the locking code. This app does not provide any services.

Expand Down
2 changes: 2 additions & 0 deletions packages/app/src/routes/202308_security/+page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const prerender = true;
export const ssr = false;
Loading

0 comments on commit fe07bf2

Please sign in to comment.