Skip to content

Commit

Permalink
refactor: wasm contract structures
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed Dec 22, 2022
1 parent 4947ffe commit d7c166f
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/mappings/wasm/contracts/base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {Interface} from "../../../types";

export class BaseStructure {
static getInterface() {
return Interface.Uncertain;
}
}
28 changes: 28 additions & 0 deletions src/mappings/wasm/contracts/bridge.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {Interface} from "../../../types";
import {BaseStructure} from "./base";

export class LegacyBridgeSwapStructure extends BaseStructure {
private cap = BigInt(0);
private reverse_aggregated_allowance = BigInt(0);
private reverse_aggregated_allowance_approver_cap = BigInt(0);
private lower_swap_limit = BigInt(0);
private upper_swap_limit = BigInt(0);
private swap_fee = BigInt(0);
private paused_since_block = BigInt(0);
private denom = "";
private next_swap_id = "";

static listProperties() {
const a = new LegacyBridgeSwapStructure();
return Object.getOwnPropertyNames(a);
}

static getPropertyType(prop: string) {
const a = new LegacyBridgeSwapStructure();
return typeof (a[prop]);
}

static getInterface() {
return Interface.LegacyBridgeSwap;
}
}
24 changes: 24 additions & 0 deletions src/mappings/wasm/contracts/cw20.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {Interface} from "../../../types";
import {BaseStructure} from "./base";

export class CW20Structure extends BaseStructure {
private name = "";
private symbol = "";
private decimals = 0;
private initial_balances: [{ amount: bigint, address: string }] = [{amount: BigInt(0), address: ""}];
private mint: { minter: string } = {minter: ""};

static listProperties() {
const a = new CW20Structure();
return Object.getOwnPropertyNames(a);
}

static getPropertyType(prop: string) {
const a = new CW20Structure();
return typeof (a[prop]);
}

static getInterface() {
return Interface.CW20;
}
}

0 comments on commit d7c166f

Please sign in to comment.