Skip to content

Commit

Permalink
refactor: [after review] Adam's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Paweł Nowosielski committed Feb 5, 2021
1 parent 4067787 commit 96f9c4b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ _Modular_ means that all the building blocks can be easily replaceable.
* [ ] Docker on Linux _(optional)_
* [ ] SGX on Graphene _(optional)_
1. Payment platform
* [x] **Payments with Erc-20**
* [x] **Gasless transactions**
* [x] **ERC20 token**
* [ ] payment matching _(optional)_
Expand Down
4 changes: 2 additions & 2 deletions accounts-example.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[
{
"driver": "ngnt",
"driver": "erc20",
"address": "0xdde2ccd1566294aa77db314501385ea50f1059c3",
"send": true,
"receive": false
}, {
"driver": "ngnt",
"driver": "erc20",
"address": "0x96af8f53f7f135824273105f94716f36970cfe75",
"send": false,
"receive": true
Expand Down
12 changes: 6 additions & 6 deletions core/payment-driver/zksync/src/zksync/faucet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub async fn request_ngnt(address: &str, network: Network) -> Result<(), Generic
}

log::info!(
"Requesting NGNT from zkSync faucet... address = {}",
"Requesting tGLM from zkSync faucet... address = {}",
address
);

Expand All @@ -43,14 +43,14 @@ pub async fn request_ngnt(address: &str, network: Network) -> Result<(), Generic
// Do not warn nor sleep at the last try.
if i >= MAX_FAUCET_REQUESTS - 1 {
log::error!(
"Failed to request NGNT from Faucet, tried {} times.: {:?}",
"Failed to request tGLM from Faucet, tried {} times.: {:?}",
MAX_FAUCET_REQUESTS,
e
);
return Err(e);
} else {
log::warn!(
"Retrying ({}/{}) to request NGNT from Faucet after failure: {:?}",
"Retrying ({}/{}) to request tGLM from Faucet after failure: {:?}",
i + 1,
MAX_FAUCET_REQUESTS,
e
Expand All @@ -65,16 +65,16 @@ pub async fn request_ngnt(address: &str, network: Network) -> Result<(), Generic
}

async fn wait_for_ngnt(address: &str, network: Network) -> Result<(), GenericError> {
log::info!("Waiting for NGNT from faucet...");
log::info!("Waiting for tGLM from faucet...");
let wait_until = Utc::now() + *MAX_WAIT;
while Utc::now() < wait_until {
if account_balance(address, network).await? >= *MIN_BALANCE {
log::info!("Received NGNT from faucet.");
log::info!("Received tGLM from faucet.");
return Ok(());
}
delay_for(time::Duration::from_secs(3)).await;
}
let msg = "Waiting for NGNT timed out.";
let msg = "Waiting for tGLM timed out.";
log::error!("{}", msg);
Err(GenericError::new(msg))
}
Expand Down
2 changes: 1 addition & 1 deletion core/payment/examples/get_accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use ya_client::web::{rest_api_url, WebClient};

#[derive(Clone, Debug, StructOpt)]
struct Args {
#[structopt(short, long, default_value = "NGNT")]
#[structopt(short, long, default_value = "tGLM")]
platform: String,
#[structopt()]
provider_addr: String,
Expand Down
8 changes: 4 additions & 4 deletions core/payment/examples/validate_allocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,21 @@ async fn main() -> anyhow::Result<()> {
};

log::info!(
"Creating allocation for {} NGNT...",
"Creating allocation for {} tGLM...",
&new_allocation.total_amount
);
requestor.create_allocation(&new_allocation).await?;
log::info!("Allocation created.");

log::info!(
"Creating another allocation for {} NGNT...",
"Creating another allocation for {} tGLM...",
&new_allocation.total_amount
);
let allocation = requestor.create_allocation(&new_allocation).await?;
log::info!("Allocation created.");

log::info!(
"Attempting to create another allocation for {} NGNT...",
"Attempting to create another allocation for {} tGLM...",
&new_allocation.total_amount
);
let result = requestor.create_allocation(&new_allocation).await;
Expand All @@ -93,7 +93,7 @@ async fn main() -> anyhow::Result<()> {
log::info!("Allocation released.");

log::info!(
"Creating another allocation for {} NGNT...",
"Creating another allocation for {} tGLM...",
&new_allocation.total_amount
);
requestor.create_allocation(&new_allocation).await?;
Expand Down

0 comments on commit 96f9c4b

Please sign in to comment.