Skip to content

Commit

Permalink
feature/abyssbetting (#84)
Browse files Browse the repository at this point in the history
* bump v0.9.30-mainnet.203
  • Loading branch information
StewartYe committed Aug 24, 2023
1 parent 677b847 commit 98d2d1b
Show file tree
Hide file tree
Showing 16 changed files with 1,709 additions and 96 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
jobs:
check:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v0.9.30-mainnet.203

- enable abyssworld betting

# v0.9.30-mainnet.202

- hot fix tournament
Expand Down
29 changes: 29 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ members = [
'pallets/bot',
'pallets/chainbridge',
'pallets/chainbridge-handler',
'pallets/abyss-tournament'
'pallets/abyss-tournament',
'pallets/abyss-mall',
]
60 changes: 60 additions & 0 deletions pallets/abyss-mall/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[package]
name = "pallet-abyss-mall"
version = "4.0.2"
authors = ["UINB Tech"]
edition = "2021"
license = "Apache-2.0"
homepage = "https://www.fusotao.org"
repository = "https://github.com/uinb/fusotao"
description = "abyssworld mall pallet"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { default-features = false, features = ['derive'], package = 'parity-scale-codec', version = '3.0.0' }
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" }
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" }
frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30"}
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" }
ascii = { version = "1.0", default-features = false }
log = { version = "0.4.14", default-features = false }
serde = { default-features = false, version = "1.0.126" }
base64 = {version = "0.13.1", default-features = false }
chrono = {version = "0.4.26", default-features = false }
sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" }
sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" }
pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" }
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" }
pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" }
fuso-support = { path = "../fuso-support", default-features = false }
pallet-chainbridge = { path = "../chainbridge", default-features = false }

[dev-dependencies]
sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" }
pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" }
pallet-fuso-verifier = {path = "../verifier", default-features = false }
pallet-fuso-token = {path = "../token", default-features = false }
pallet-fuso-indicator = {path = "../indicator", default-features = false }
hex = "0.4.3"
[features]
default = ['std']
std = [
'codec/std',
'frame-support/std',
'frame-system/std',
'frame-benchmarking/std',
'sp-std/std',
'sp-core/std',
'sp-io/std',
'sp-runtime/std',
'pallet-fuso-token/std',
'pallet-fuso-verifier/std',
'chrono/std'
]
runtime-benchmarks = [
'frame-benchmarking',
'frame-support/runtime-benchmarks',
'frame-system/runtime-benchmarks',
]
83 changes: 83 additions & 0 deletions pallets/abyss-mall/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Copyright 2021-2023 UINB Technologies Pte. Ltd.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(not(feature = "std"), no_std)]
pub use pallet::*;

#[frame_support::pallet]
pub mod pallet {
use ascii::AsciiStr;

Check warning on line 20 in pallets/abyss-mall/src/lib.rs

View workflow job for this annotation

GitHub Actions / check

unused import: `ascii::AsciiStr`
use chrono::NaiveDateTime;

Check warning on line 21 in pallets/abyss-mall/src/lib.rs

View workflow job for this annotation

GitHub Actions / check

unused import: `chrono::NaiveDateTime`
use frame_support::traits::fungibles::Mutate;

Check warning on line 22 in pallets/abyss-mall/src/lib.rs

View workflow job for this annotation

GitHub Actions / check

unused import: `frame_support::traits::fungibles::Mutate`
use frame_support::traits::{tokens::BalanceConversion, Time};

Check warning on line 23 in pallets/abyss-mall/src/lib.rs

View workflow job for this annotation

GitHub Actions / check

unused import: `Time`
use frame_support::{pallet_prelude::*, transactional};
use frame_system::pallet_prelude::*;
use fuso_support::chainbridge::*;

Check warning on line 26 in pallets/abyss-mall/src/lib.rs

View workflow job for this annotation

GitHub Actions / check

unused import: `fuso_support::chainbridge::*`
use fuso_support::traits::{DecimalsTransformer, PriceOracle, ReservableToken, Token};

Check warning on line 27 in pallets/abyss-mall/src/lib.rs

View workflow job for this annotation

GitHub Actions / check

unused imports: `DecimalsTransformer`, `PriceOracle`
use pallet_chainbridge as bridge;
use sp_core::bounded::BoundedBTreeMap;
use sp_runtime::traits::{TrailingZeroInput, Zero};
use sp_runtime::Perquintill;
use sp_std::vec;
use sp_std::vec::Vec;

type BalanceOf<T> = <<T as bridge::Config>::Fungibles as Token<
<T as frame_system::Config>::AccountId,
>>::Balance;

type AssetId<T> = <<T as bridge::Config>::Fungibles as Token<
<T as frame_system::Config>::AccountId,
>>::TokenId;

#[pallet::config]
pub trait Config: frame_system::Config + bridge::Config {
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

type Assets: ReservableToken<Self::AccountId>;

type BalanceConversion: BalanceConversion<BalanceOf<Self>, AssetId<Self>, BalanceOf<Self>>;

#[pallet::constant]
type AwtTokenId: Get<AssetId<Self>>;
}

#[pallet::event]
#[pallet::generate_deposit(pub (super) fn deposit_event)]
pub enum Event<T: Config> {}

#[pallet::error]
pub enum Error<T> {}

#[pallet::pallet]
#[pallet::without_storage_info]
#[pallet::generate_store(pub (super) trait Store)]
pub struct Pallet<T>(_);

#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}

#[pallet::call]
impl<T: Config> Pallet<T> {
#[transactional]
#[pallet::weight(195_000_000)]
pub fn stake_awt(
origin: OriginFor<T>,
awt_amount: BalanceOf<T>,
days: u16,
) -> DispatchResultWithPostInfo {
let who = ensure_signed(origin)?;
Ok(().into())
}
}
}
Loading

0 comments on commit 98d2d1b

Please sign in to comment.