8000 convert u128 to U128 when used in `json!` by lachlanglen · Pull Request #66 · PotLock/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

convert u128 to U128 when used in json! #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified contracts/donation/out/main.wasm
Binary file not shown.
8 changes: 4 additions & 4 deletions contracts/donation/src/donations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ impl Contract {
),
)
} else {
let ft_transfer_args = json!({ "receiver_id": recipient_id, "amount": amount })
let ft_transfer_args = json!({ "receiver_id": recipient_id, "amount": U128(amount) })
.to_string()
.into_bytes();
PromiseOrValue::Promise(
Expand Down Expand Up @@ -429,7 +429,7 @@ impl Contract {
// return funds to donor
if is_ft_transfer {
let donation_transfer_args =
json!({ "receiver_id": donation.donor_id, "amount": donation.total_amount.clone() })
json!({ "receiver_id": donation.donor_id, "amount": U128(donation.total_amount.clone()) })
.to_string()
.into_bytes();
Promise::new(AccountId::new_unchecked(donation.ft_id.to_string()))
Expand Down Expand Up @@ -467,7 +467,7 @@ impl Contract {
// return funds to donor
if is_ft_transfer {
let donation_transfer_args =
json!({ "receiver_id": donation.donor_id, "amount": donation.protocol_fee })
json!({ "receiver_id": donation.donor_id, "amount": U128(donation.protocol_fee) })
.to_string()
.into_bytes();
Promise::new(AccountId::new_unchecked(donation.ft_id.to_string()))
Expand Down Expand Up @@ -496,7 +496,7 @@ impl Contract {
// return funds to donor
if is_ft_transfer {
let donation_transfer_args =
json!({ "receiver_id": donation.donor_id, "amount": donation.referrer_fee })
json!({ "receiver_id": donation.donor_id, "amount": donation.referrer_fee.map(|v| U128(v)) })
.to_string()
.into_bytes();
Promise::new(AccountId::new_unchecked(donation.ft_id.to_string()))
Expand Down
0