本文へスキップ
Skillpedia
APIとサーバー(バックエンド)48k · #4361

defi-protocol-templates

できること

分散型金融(DeFi)向けの、すぐに使えるテンプレートを作成するツールです。ステーキング、トークン交換(AMM)、投票(ガバナンス)、貸し出し(レンディング)といったシステムの土台を提供します。

使う場面

  • ✓報酬の分配を備えたステーキングプラットフォームを作るとき。
  • ✓自動マーケットメイカー(AMM)の仕組みを実装するとき。
  • ✓プロジェクトの投票のためのトークンシステムを作るとき。

スキルのリンク

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/defi-protocol-templates/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/defi-protocol-templates/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“「報酬付きのステーキングシステムのテンプレートを作成してください。」”

毎週5つの新しいスキル。1分で読めます。

仕組み

このツールは、土台として使える事前に書かれたコード(テンプレート)を提供します。これらのコードは、さまざまな種類のDeFiプロトコルのベストプラクティスに沿っています。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Supporting material availability

This catalog copy contains the inline guidance below, but does not include the following supporting paths. They are external prerequisites, not bundled files:

  • <support-root>/references/staking.md
  • <support-root>/references/liquidity-pools.md
  • <support-root>/references/governance-tokens.md
  • <support-root>/references/lending-protocols.md
  • <support-root>/references/flash-loans.md
  • <support-root>/assets/staking-contract.sol
  • <support-root>/assets/amm-contract.sol
  • <support-root>/assets/governance-token.sol
  • <support-root>/assets/lending-protocol.sol

Ask for the original supporting material or an existing installation before using a step that depends on these paths; this catalog does not identify a verified download source for them. Resolve each path relative to that installation, inspect its contents, and verify any applicable license and execution prerequisites. Do not run a command or claim a referenced procedure was followed until its required file exists. Do not fabricate the missing scripts or treat an unrelated file with the same name as equivalent. Independent steps fully documented here can proceed within the user’s authorized scope; report any dependent step as unavailable.

DeFi Protocol Templates

Production-ready templates for common DeFi protocols including staking, AMMs, governance, lending, and flash loans.

Do not use this skill when

  • The task is unrelated to defi protocol templates
  • You need a different domain or tool outside this scope

Instructions

  • Clarify goals, constraints, and required inputs.
  • Apply relevant best practices and validate outcomes.
  • Provide actionable steps and verification.

Use this skill when

  • Building staking platforms with reward distribution
  • Implementing AMM (Automated Market Maker) protocols
  • Creating governance token systems
  • Developing lending/borrowing protocols
  • Integrating flash loan functionality
  • Launching yield farming platforms

Staking Contract

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract StakingRewards is ReentrancyGuard, Ownable {
    IERC20 public stakingToken;
    IERC20 public rewardsToken;

    uint256 public rewardRate = 100; // Rewards per second
    uint256 public lastUpdateTime;
    uint256 public rewardPerTokenStored;

    mapping(address => uint256) public userRewardPerTokenPaid;
    mapping(address => uint256) public rewards;
    mapping(address => uint256) public balances;

    uint256 private _totalSupply;

    event Staked(address indexed user, uint256 amount);
    event Withdrawn(address indexed user, uint256 amount);
    event RewardPaid(address indexed user, uint256 reward);

    constructor(address _stakingToken, address _rewardsToken) {
        stakingToken = IERC20(_stakingToken);
        rewardsToken = IERC20(_rewardsToken);
    }

    modifier updateReward(address account) {
        rewardPerTokenStored = rewardPerToken();
        lastUpdateTime = block.timestamp;

        if (account != address(0)) {
            rewards[account] = earned(account);
            userRewardPerTokenPaid[account] = rewardPerTokenStored;
        }
        _;
    }

    function rewardPerToken() public view returns (uint256) {
        if (_totalSupply == 0) {
            return rewardPerTokenStored;
        }
        return rewardPerTokenStored +
            ((block.timestamp - lastUpdateTime) * rewardRate * 1e18) / _totalSupply;
    }

    function earned(address account) public view returns (uint256) {
        return (balances[account] *
            (rewardPerToken() - userRewardPerTokenPaid[account])) / 1e18 +
            rewards[account];
    }

    function stake(uint256 amount) external nonReentrant updateReward(msg.sender) {
        require(amount > 0, "Cannot stake 0");
        _totalSupply += amount;
        balances[msg.sender] += amount;
        stakingToken.transferFrom(msg.sender, address(this), amount);
        emit Staked(msg.sender, amount);
    }

    function withdraw(uint256 amount) public nonReentrant updateReward(msg.sender) {
        require(amount > 0, "Cannot withdraw 0");
        _totalSupply -= amount;
        balances[msg.sender] -= amount;
        stakingToken.transfer(msg.sender, amount);
        emit Withdrawn(msg.sender, amount);
    }


…
よくある質問

分散型金融(DeFi)とは何ですか?

ブロックチェーン技術の上に構築された金融サービスのことです。銀行などの従来の仲介者を介さずに、貸し出し、取引、投資などを行えます。

ステーキングとは何ですか?

ブロックチェーンネットワークの運営を支えるために暗号資産をロックし、その見返りとして報酬を受け取る仕組みです。

AMMとは何ですか?

Automated Market Makerの略で、流動性プールを使い、従来の買い手や売り手を介さずに暗号資産を交換できるプロトコルの一種です。

詳細

作者による元の説明

Implement DeFi protocols with production-ready templates for staking, AMMs, governance, and lending systems. Use when building decentralized finance applications or smart contract protocols.

repo: sickn33/agentic-awesome-skills

人気

GitHubのスター
48k
ランキング
#4361
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル