Skip to content

Instantly share code, notes, and snippets.

View Enigo's full-sized avatar

Ruslan S. Enigo

View GitHub Profile
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'Jenkins Role'
Resources:
JenkinsRole:
Type: AWS::IAM::Role
Properties:
Description: "Used for serverspec tests"
RoleName: jenkins-serverspec
require 'serverspec'
set :backend, :exec
describe command('lsb_release -a') do
its(:stdout){ should contain 'Ubuntu' }
end
#!groovy
import groovy.transform.Field
@Field
def keyName
@Field
def instanceId
@Field
def securityGroupId
require 'serverspec'
require_relative '../serverspec_config'
describe command('lsb_release -a') do
its(:stdout){ should contain 'Ubuntu' }
end
require 'serverspec'
set :disable_sudo, true
set :backend, :ssh
set :host, ENV['INSTANCE_IP']
set :ssh_options, {
:user => 'ubuntu',
:auth_methods => [ 'publickey' ],
:keys => [ ENV['SSH_KEY_PATH'] ],
async fn process_wallet(wallet: String, api_key: &String) {
let mut page = 1;
let mut transaction_to_token_id = HashMap::new();
loop {
let transactions = fetch_transactions(wallet.clone(), api_key, page).await;
if transactions.is_empty() {
break;
}
for res in transactions {
const LAND_CONTRACT: &str = "0x7a47f7707c4b2f2b1def04a47cd8681d48eadeb8";
const LAND_CONTRACT_CREATION_BLOCK: &str = "14846665";
const LAND_FUNCTION_NAME: &str = "buyL2";
pub async fn read_transactions() {
let api_key = String::from("ETHERSCAN_API_KEY_VALUE");
match mints_reader::read_mints().await {
Some(mints) => {
let mut futures = futures::stream::iter(mints.result)
.map(|res| process_wallet(res.wallet, &api_key))
@Enigo
Enigo / token.rs
Last active April 29, 2023 13:56
#[derive(Deserialize, Debug)]
pub struct Token {
pub status: String,
pub result: Option<Vec<TheResult>>,
}
#[derive(Deserialize, Debug)]
pub struct TheResult {
pub hash: String,
pub value: String,
#[derive(Deserialize, Debug)]
pub struct Transaction {
pub status: String,
pub result: Option<Vec<TheResult>>,
}
#[derive(Deserialize, Debug)]
pub struct TheResult {
pub hash: String,
pub from: String,
const MINTS_URL: &str = "https://api.x.immutable.com/v1/mints?token_address=0x9e0d99b864e1ac12565125c5a82b59adea5a09cd&page_size=200";
pub async fn read_mints() -> Option<Mint> {
match api_utils::fetch_single_api_response::<Mint>(MINTS_URL).await {
Ok(mints) => { Some(mints) }
Err(e) => {
error!("Error fetching mints {e}");
None
}
}