Skip to content

Commit

Permalink
Sync testnet to main (#236)
Browse files Browse the repository at this point in the history
* Sync development to testnet (#221)

* Amount validity check update

* Airdrop fund and register subtitle fix (#219)

* Fix subtitles for airdrop register & fund

* Typo fix

* Native token airdrop support (#220)

* Add token selection UI to airdrop create page

* Fix native token logic on airdrop create

* Add new method for funding in merkle airdrop contract

* Update airdrop props

* Use correct funding method based on airdrop token

* Implement native token logic on claim page

* Fix client error on website load

* Update instantiate message with native token

* Fix balance error on website load

Co-authored-by: Serkan Reis <[email protected]>

* Merge development to testnet (#226)

* Amount validity check update

* Airdrop fund and register subtitle fix (#219)

* Fix subtitles for airdrop register & fund

* Typo fix

* Native token airdrop support (#220)

* Add token selection UI to airdrop create page

* Fix native token logic on airdrop create

* Add new method for funding in merkle airdrop contract

* Update airdrop props

* Use correct funding method based on airdrop token

* Implement native token logic on claim page

* Fix client error on website load

* Update instantiate message with native token

* Fix balance error on website load

* Manage (burn or withdraw) remaining funds for an expired airdrop (#223)

* Feature: Terra airdrop support (#224)

* Sync development to testnet (#205)

* Remove comment

* Update testnet chain id

* Merge development to testnet (#214)

* Remove comment

* Update testnet chain id

* Typo fixes (#208)

* Changed "swiss knife" to "Swiss Army knife"
* Removed unnecessary and unconventional "as" before "Smart Contract Dashboard"
* Capitalized first letter of "Airdrops" and "Create Airdrop" page names, changed reference to Create Airdrop page to mention the page name

* Sign and verify placeholder (#207)

* add placeholders for sign and verify

* Fix signature placeholder

* fix placeholder

* update testnet explorer

* Add features to keplr config

* The utility function isValidAccountsFile() now includes a check for duplicate addresses

* Json formatted execute operation entry changed (#206)

* Json formatted execute operation entry turned into form like formatted entry

* Minor fixs

* Minor fixes

* Minor fixes

* Walletless query (#212)

* Wallet.tsx client turned into cosmwasmclient when not initialised

* Minor fix

* Minor fixes

Co-authored-by: Lyte <[email protected]>
Co-authored-by: Highlander <[email protected]>
Co-authored-by: Highlander-Maker <[email protected]>
Co-authored-by: Furkan Kaymak <[email protected]>
Co-authored-by: Serkan Reis <[email protected]>
Co-authored-by: name-user1 <[email protected]>

* Bump version

* Add terra related logic (#2)

* Add terra related logic to whitelist processing

* Set terra airdrop flag on airdrop creation

* Update airdrop props

* Add terra related logic to merkle contract helpers

* Add terra logic to claim page

* Update logic

* Show claim button for all terra airdrops

* Include signature in Terra airdrop claim messages

* Revert "Include signature in Terra airdrop claim messages"

This reverts commit ecaed19.

* Include "sig_info" in Terra airdrop claim messages (#4)

* Include signature in Terra airdrop claim messages

* Remove txSigner from burn message on merkle airdrop

* Remove unused code

* Add comments for later on

Co-authored-by: findolor <[email protected]>

* Add hrp field

* Setup redirects and fix manage page error

* Refactor claim page terra airdrop logic

Co-authored-by: Lyte <[email protected]>
Co-authored-by: Highlander <[email protected]>
Co-authored-by: Highlander-Maker <[email protected]>
Co-authored-by: Furkan Kaymak <[email protected]>
Co-authored-by: Serkan Reis <[email protected]>
Co-authored-by: name-user1 <[email protected]>

* Revert "Merge branch 'testnet' into development"

This reverts commit f370b81, reversing
changes made to c94efb3.

* Remove txSigner from claim method in airdrop helpers

Co-authored-by: Serkan Reis <[email protected]>
Co-authored-by: Lyte <[email protected]>
Co-authored-by: Highlander <[email protected]>
Co-authored-by: Highlander-Maker <[email protected]>
Co-authored-by: Furkan Kaymak <[email protected]>
Co-authored-by: name-user1 <[email protected]>

* Sync development to testnet (#235)

* Amount validity check update

* Airdrop fund and register subtitle fix (#219)

* Fix subtitles for airdrop register & fund

* Typo fix

* Native token airdrop support (#220)

* Add token selection UI to airdrop create page

* Fix native token logic on airdrop create

* Add new method for funding in merkle airdrop contract

* Update airdrop props

* Use correct funding method based on airdrop token

* Implement native token logic on claim page

* Fix client error on website load

* Update instantiate message with native token

* Fix balance error on website load

* Manage (burn or withdraw) remaining funds for an expired airdrop (#223)

* Feature: Terra airdrop support (#224)

* Sync development to testnet (#205)

* Remove comment

* Update testnet chain id

* Merge development to testnet (#214)

* Remove comment

* Update testnet chain id

* Typo fixes (#208)

* Changed "swiss knife" to "Swiss Army knife"
* Removed unnecessary and unconventional "as" before "Smart Contract Dashboard"
* Capitalized first letter of "Airdrops" and "Create Airdrop" page names, changed reference to Create Airdrop page to mention the page name

* Sign and verify placeholder (#207)

* add placeholders for sign and verify

* Fix signature placeholder

* fix placeholder

* update testnet explorer

* Add features to keplr config

* The utility function isValidAccountsFile() now includes a check for duplicate addresses

* Json formatted execute operation entry changed (#206)

* Json formatted execute operation entry turned into form like formatted entry

* Minor fixs

* Minor fixes

* Minor fixes

* Walletless query (#212)

* Wallet.tsx client turned into cosmwasmclient when not initialised

* Minor fix

* Minor fixes

Co-authored-by: Lyte <[email protected]>
Co-authored-by: Highlander <[email protected]>
Co-authored-by: Highlander-Maker <[email protected]>
Co-authored-by: Furkan Kaymak <[email protected]>
Co-authored-by: Serkan Reis <[email protected]>
Co-authored-by: name-user1 <[email protected]>

* Bump version

* Add terra related logic (#2)

* Add terra related logic to whitelist processing

* Set terra airdrop flag on airdrop creation

* Update airdrop props

* Add terra related logic to merkle contract helpers

* Add terra logic to claim page

* Update logic

* Show claim button for all terra airdrops

* Include signature in Terra airdrop claim messages

* Revert "Include signature in Terra airdrop claim messages"

This reverts commit ecaed19.

* Include "sig_info" in Terra airdrop claim messages (#4)

* Include signature in Terra airdrop claim messages

* Remove txSigner from burn message on merkle airdrop

* Remove unused code

* Add comments for later on

Co-authored-by: findolor <[email protected]>

* Add hrp field

* Setup redirects and fix manage page error

* Refactor claim page terra airdrop logic

Co-authored-by: Lyte <[email protected]>
Co-authored-by: Highlander <[email protected]>
Co-authored-by: Highlander-Maker <[email protected]>
Co-authored-by: Furkan Kaymak <[email protected]>
Co-authored-by: Serkan Reis <[email protected]>
Co-authored-by: name-user1 <[email protected]>

* Revert "Merge branch 'testnet' into development"

This reverts commit f370b81, reversing
changes made to c94efb3.

* Remove txSigner from claim method in airdrop helpers

* Get correct token balance based on token type (#233)

* Custom decimal on denom conversion (#234)

* Add decimal parameter to denom conversion

* Add custom decimals to conversion method

* Change contract parameter to be recipient for cw20 execute send (#232)

Co-authored-by: Serkan Reis <[email protected]>
Co-authored-by: Lyte <[email protected]>
Co-authored-by: Highlander <[email protected]>
Co-authored-by: Highlander-Maker <[email protected]>
Co-authored-by: Furkan Kaymak <[email protected]>
Co-authored-by: name-user1 <[email protected]>

Co-authored-by: Serkan Reis <[email protected]>
Co-authored-by: Lyte <[email protected]>
Co-authored-by: Highlander <[email protected]>
Co-authored-by: Highlander-Maker <[email protected]>
Co-authored-by: Furkan Kaymak <[email protected]>
Co-authored-by: name-user1 <[email protected]>
  • Loading branch information
7 people authored Aug 19, 2022
1 parent d274dc8 commit 1e221db
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 28 deletions.
32 changes: 16 additions & 16 deletions pages/airdrops/[address]/claim.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,21 @@ const ClaimAirdropPage: NextPage = () => {
}, [contractAddress, wallet.address, wallet.initialized, wallets[0]?.terraAddress])

useEffect(() => {
setBalance(Number(wallet.balance[0]?.amount))
}, [wallet.balance])
if (cw20TokenAddress) {
if (!cw20BaseContract) return

useEffect(() => {
if (!cw20BaseContract || !cw20TokenAddress) return
const contractMessages = cw20BaseContract.use(cw20TokenAddress)

const contractMessages = cw20BaseContract.use(cw20TokenAddress)

contractMessages
?.balance(wallet.address)
.then((data: string) => {
setBalance(parseInt(data))
})
.catch(console.error)
}, [cw20TokenAddress, wallet.address])
contractMessages
?.balance(wallet.address)
.then((data: string) => {
setBalance(parseInt(data))
})
.catch(console.error)
} else {
setBalance(Number(wallet.balance[0]?.amount))
}
}, [cw20TokenAddress, wallet.address, wallet.balance])

useEffect(() => {
if (!cw20BaseContract || !cw20TokenAddress) return
Expand Down Expand Up @@ -281,7 +281,7 @@ const ClaimAirdropPage: NextPage = () => {
<div className="flex-grow" />
<img alt="juno" className="w-6 h-6 rounded-full" src="/juno_logo.png" />
<span className="font-bold">
{convertDenomToReadable(amount)} {cw20TokenInfo?.symbol}
{convertDenomToReadable(amount, cw20TokenInfo?.decimals)} {cw20TokenInfo?.symbol}
</span>
</div>
<StackedList>
Expand All @@ -293,10 +293,10 @@ const ClaimAirdropPage: NextPage = () => {
<StackedList.Item name="Token Address">{cw20TokenAddress}</StackedList.Item>
</Conditional>
<StackedList.Item name="Claim Amount">
{convertDenomToReadable(amount)} {cw20TokenInfo?.symbol}
{convertDenomToReadable(amount, cw20TokenInfo?.decimals)} {cw20TokenInfo?.symbol}
</StackedList.Item>
<StackedList.Item name="Your Token Balance">
{convertDenomToReadable(balance)} {cw20TokenInfo?.symbol}
{convertDenomToReadable(balance, cw20TokenInfo?.decimals)} {cw20TokenInfo?.symbol}
</StackedList.Item>
<StackedList.Item name="Merkle Proofs">
<pre className="overflow-auto p-2 text-sm bg-stone-800/80 rounded">{JSON.stringify(proofs, null, 2)}</pre>
Expand Down
8 changes: 5 additions & 3 deletions pages/airdrops/fund.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const FundAirdropPage: NextPage = () => {
const [balance, setBalance] = useState<number | null>(null)
const [target, setTarget] = useState<number | null>(null)
const [denom, setDenom] = useState<string | null>(null)
const [decimals, setDecimals] = useState<number>(6)

const [method, setMethod] = useState<FundMethod>('mint')

Expand Down Expand Up @@ -78,6 +79,7 @@ const FundAirdropPage: NextPage = () => {
setTarget(_target)
setAmount(needed < 0 ? '0' : needed.toString())
setDenom(_denom)
setDecimals(data.decimals)
})
.catch((err: any) => {
toast.error(err.message, {
Expand Down Expand Up @@ -207,7 +209,7 @@ const FundAirdropPage: NextPage = () => {
<Stats title="Total amount">
{balance ? (
<>
{convertDenomToReadable(target)} <Stats.Denom text={denom} />
{convertDenomToReadable(target, decimals)} <Stats.Denom text={denom} />
</>
) : (
'...'
Expand All @@ -216,7 +218,7 @@ const FundAirdropPage: NextPage = () => {
<Stats title="Contract balance">
{balance ? (
<>
{convertDenomToReadable(balance)} <Stats.Denom text={denom} />
{convertDenomToReadable(balance, decimals)} <Stats.Denom text={denom} />
</>
) : (
'...'
Expand All @@ -225,7 +227,7 @@ const FundAirdropPage: NextPage = () => {
<Stats title="Amount needed">
{target && balance ? (
<>
{convertDenomToReadable(amount)} <Stats.Denom text={denom} />
{convertDenomToReadable(amount, decimals)} <Stats.Denom text={denom} />
</>
) : (
'...'
Expand Down
9 changes: 6 additions & 3 deletions pages/airdrops/manage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const ManageAirdropPage: NextPage = () => {
const [balance, setBalance] = useState<number | null>(null)
const [target, setTarget] = useState<number | null>(null)
const [denom, setDenom] = useState<string | null>(null)
const [decimals, setDecimals] = useState<number>(6)

const [recipientAddress, setRecipientAddress] = useState<string | null>(null)
const [isExpired, setIsExpired] = useState<boolean>(false)

Expand Down Expand Up @@ -69,6 +71,7 @@ const ManageAirdropPage: NextPage = () => {
setTarget(_target)
setAmount(needed < 0 ? '0' : needed.toString())
setDenom(_denom)
setDecimals(data.decimals)
})
.catch((err: any) => {
toast.error(err.message, {
Expand Down Expand Up @@ -266,7 +269,7 @@ const ManageAirdropPage: NextPage = () => {
<Stats title="Total amount">
{balance ? (
<>
{convertDenomToReadable(target)} <Stats.Denom text={denom} />
{convertDenomToReadable(target, decimals)} <Stats.Denom text={denom} />
</>
) : (
'...'
Expand All @@ -275,7 +278,7 @@ const ManageAirdropPage: NextPage = () => {
<Stats title="Contract balance">
{balance ? (
<>
{convertDenomToReadable(balance)} <Stats.Denom text={denom} />
{convertDenomToReadable(balance, decimals)} <Stats.Denom text={denom} />
</>
) : (
'...'
Expand All @@ -284,7 +287,7 @@ const ManageAirdropPage: NextPage = () => {
<Stats title="Amount needed">
{target && balance ? (
<>
{convertDenomToReadable(amount)} <Stats.Denom text={denom} />
{convertDenomToReadable(amount, decimals)} <Stats.Denom text={denom} />
</>
) : (
'...'
Expand Down
8 changes: 4 additions & 4 deletions utils/contracts/cw20/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export type DispatchExecuteArgs = {
| { type: Select<'decrease-allowance'>; recipient: string; amount: string }
| { type: Select<'transfer'>; recipient: string; amount: string }
| { type: Select<'transfer-from'>; owner: string; recipient: string; amount: string }
| { type: Select<'send'>; contract: string; amount: string; msg: any }
| { type: Select<'send'>; recipient: string; amount: string; msg: any }
| { type: Select<'send-from'>; owner: string; recipient: string; amount: string; msg: any }
| { type: Select<'update-marketing'>; project: string; description: string; marketing: string }
| { type: Select<'update-logo'>; logo: { url: string } }
Expand Down Expand Up @@ -138,7 +138,7 @@ export const dispatchExecute = async (args: DispatchExecuteArgs) => {
return messages.transferFrom(txSigner, args.owner, args.recipient, args.amount.toString())
}
case 'send': {
return messages.send(txSigner, args.contract, args.amount.toString(), args.msg)
return messages.send(txSigner, args.recipient, args.amount.toString(), args.msg)
}
case 'send-from': {
return messages.sendFrom(txSigner, args.owner, args.recipient, args.amount.toString(), args.msg)
Expand Down Expand Up @@ -188,8 +188,8 @@ export const previewExecutePayload = (args: DispatchExecuteArgs) => {
return messages()?.transferFrom(contract, owner, recipient, amount.toString())
}
case 'send': {
const { contract, amount, msg } = args
return messages()?.send(contract, contract, amount.toString(), msg)
const { contract, recipient, amount, msg } = args
return messages()?.send(contract, recipient, amount.toString(), msg)
}
case 'send-from': {
const { contract, amount, msg, owner, recipient } = args
Expand Down
4 changes: 2 additions & 2 deletions utils/convertDenomToReadable.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const convertDenomToReadable = (amount: string | number | null) => {
return Number(amount) / 1000000
export const convertDenomToReadable = (amount: string | number | null, decimal = 6) => {
return Number(amount) / Math.pow(10, decimal)
}

0 comments on commit 1e221db

Please sign in to comment.