Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

feat: Airswap integration #245

Merged
merged 5 commits into from Apr 25, 2022
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
30 changes: 30 additions & 0 deletions src/apps/airswap/airswap.definition.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Register } from '~app-toolkit/decorators';
import { AppDefinition } from '~app/app.definition';
import { GroupType, ProtocolAction, ProtocolTag } from '~app/app.interface';
import { Network } from '~types/network.interface';

export const AIRSWAP_DEFINITION = {
id: 'airswap',
name: 'Airswap',
description:
'AirSwap is an open community of developers, designers, writers, and tinkerers building decentralized trading systems. Protocol fees are automatically distributed to contributors.',
url: 'https://airswap.io',
symbol: 'AST',
groups: {
sAST: {id: 's-ast', type: GroupType.TOKEN},
},
tags: [ProtocolTag.EXCHANGE],
supportedNetworks: {
[Network.ETHEREUM_MAINNET]: [ProtocolAction.VIEW],
},
primaryColor: '#2B71FF',
};

@Register.AppDefinition(AIRSWAP_DEFINITION.id)
export class AirswapAppDefinition extends AppDefinition {
constructor() {
super(AIRSWAP_DEFINITION);
}
}

export default AIRSWAP_DEFINITION;
18 changes: 18 additions & 0 deletions src/apps/airswap/airswap.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Module } from '@nestjs/common';

import { AbstractDynamicApp } from '~app/app.dynamic-module';

import { AirswapAppDefinition } from './airswap.definition';
import { AirswapContractFactory } from './contracts';
import { EthereumAirswapBalanceFetcher } from './ethereum/airswap.balance-fetcher';
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is airswap.balance-fetcher necessary? Since airswap tokens are already shown on dashboard.

import { EthereumAirswapSAstTokenFetcher } from './ethereum/airswap.s-ast.token-fetcher';

@Module({
providers: [
AirswapAppDefinition,
AirswapContractFactory,
EthereumAirswapBalanceFetcher,
EthereumAirswapSAstTokenFetcher,
],
})
export class AirswapAppModule extends AbstractDynamicApp<AirswapAppModule>() {}
Binary file added src/apps/airswap/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
243 changes: 243 additions & 0 deletions src/apps/airswap/contracts/abis/staking.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
[
{
"inputs": [
{ "internalType": "contract ERC20", "name": "_token", "type": "address" },
{ "internalType": "string", "name": "_name", "type": "string" },
{ "internalType": "string", "name": "_symbol", "type": "string" },
{ "internalType": "uint256", "name": "_duration", "type": "uint256" },
{ "internalType": "uint256", "name": "_minDelay", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{ "anonymous": false, "inputs": [], "name": "CancelDurationChange", "type": "event" },
{
"anonymous": false,
"inputs": [{ "indexed": true, "internalType": "uint256", "name": "newDuration", "type": "uint256" }],
"name": "CompleteDurationChange",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "delegate", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "account", "type": "address" }
],
"name": "ProposeDelegate",
"type": "event"
},
{
"anonymous": false,
"inputs": [{ "indexed": true, "internalType": "uint256", "name": "unlockTimestamp", "type": "uint256" }],
"name": "ScheduleDurationChange",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "delegate", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "account", "type": "address" }
],
"name": "SetDelegate",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "from", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "to", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "tokens", "type": "uint256" }
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
"name": "accountDelegates",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "account", "type": "address" }],
"name": "available",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "account", "type": "address" }],
"name": "balanceOf",
"outputs": [{ "internalType": "uint256", "name": "total", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{ "inputs": [], "name": "cancelDurationChange", "outputs": [], "stateMutability": "nonpayable", "type": "function" },
{
"inputs": [],
"name": "decimals",
"outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
"name": "delegateAccounts",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "duration",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "account", "type": "address" }],
"name": "getStakes",
"outputs": [
{
"components": [
{ "internalType": "uint256", "name": "duration", "type": "uint256" },
{ "internalType": "uint256", "name": "balance", "type": "uint256" },
{ "internalType": "uint256", "name": "timestamp", "type": "uint256" }
],
"internalType": "struct IStaking.Stake",
"name": "accountStake",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "delegate", "type": "address" }],
"name": "proposeDelegate",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
"name": "proposedDelegates",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{ "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" },
{
"inputs": [{ "internalType": "uint256", "name": "delay", "type": "uint256" }],
"name": "scheduleDurationChange",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "account", "type": "address" }],
"name": "setDelegate",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "_duration", "type": "uint256" }],
"name": "setDuration",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "string", "name": "_name", "type": "string" },
{ "internalType": "string", "name": "_symbol", "type": "string" }
],
"name": "setMetaData",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }],
"name": "stake",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "account", "type": "address" },
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
],
"name": "stakeFor",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "token",
"outputs": [{ "internalType": "contract ERC20", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "delegate", "type": "address" }],
"name": "unsetDelegate",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }],
"name": "unstake",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
Loading