Skip to content

Instantly share code, notes, and snippets.

View sergio11's full-sized avatar
🏠
Working from home

Sergio Sánchez Sánchez sergio11

🏠
Working from home
View GitHub Profile
@sergio11
sergio11 / DeFiPlexGovernanceContract.sol
Created July 2, 2024 19:24
DeFiPlexGovernanceContract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./DeFiPlexGovernanceTokenContract.sol";
import "./IDeFiPlexGovernanceContract.sol";
/**
* @title DeFiPlexGovernanceContract
* @dev This contract manages governance proposals for DeFiPlex platform.
@sergio11
sergio11 / DeFiPlexGovernanceTokenContract.sol
Created July 2, 2024 19:22
DeFiPlexGovernanceTokenContract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title DeFiPlexGovernanceTokenContract
* @dev Implementation of a governance token allowing holders to vote on proposals.
*/
@sergio11
sergio11 / PlexTokenERC20Contract.sol
Created July 2, 2024 19:16
PlexTokenERC20Contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract PlexTokenERC20Contract is ERC20Burnable, Ownable {
uint256 private constant INITIAL_SUPPLY = 1000000 * 10 ** 18; // 1,000,000 tokens with 18 decimals
constructor(address initialOwner) ERC20("Plex Token", "PLEX") Ownable(initialOwner) {
@sergio11
sergio11 / DeFiPlexLendingPoolContract.sol
Created July 2, 2024 19:15
DeFiPlexLendingPoolContract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IDeFiPlexLendingPoolContract.sol";
import "./IDeFiPlexGovernanceContract.sol";
import "./IDeFiPlexStakingContract.sol";
@sergio11
sergio11 / DeFiPlexStakingContract.sol
Created July 2, 2024 19:12
DeFiPlexStakingContract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IDeFiPlexStakingContract.sol";
/**
* @title DeFiPlex Staking Contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "./IEventChainContract.sol";
import "./IEventChainEventManagerContract.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title EventChainEventManagerContract
* @dev This contract manages the creation and organization of events. It allows event organizers
@sergio11
sergio11 / EventChainContract.sol
Created June 13, 2024 19:29
EventChainContract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IEventChainContract.sol";
/**
@sergio11
sergio11 / verify_voice_id_operator.py
Created May 15, 2024 18:36
Verify Voice ID operator
from airflow.utils.decorators import apply_defaults
import jwt
from operators.base_web3_custom_operator import BaseWeb3CustomOperator
from datetime import datetime, timedelta, timezone
class VerifyVoiceIdOperator(BaseWeb3CustomOperator):
"""
An operator to verify a user's voice ID using a Smart Contract on the Ethereum blockchain.
Inherits:
@sergio11
sergio11 / find_most_similar_voice_operator.py
Created May 15, 2024 18:24
Find Most similar voice operator
from operators.base_custom_operator import BaseCustomOperator
from airflow.utils.decorators import apply_defaults
from qdrant_client import QdrantClient
class FindMostSimilarVoiceOperator(BaseCustomOperator):
"""
Custom Airflow operator to find the most similar voice based on audio embeddings.
This operator searches for the most similar voice in a given collection using audio embeddings
generated from an input audio file. It connects to a QDrant server to perform the search.
@sergio11
sergio11 / voice_authentication_dag.py
Created May 15, 2024 18:06
Voice Authentication DAG
from datetime import datetime
from airflow import DAG
import importlib
import os
# Define default arguments for the DAG
default_args = {
'owner': 'airflow',
'start_date': datetime(2023, 1, 1),
'retries': 1,