Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strict types for reward distributors #63

Merged
merged 1 commit into from
Jun 18, 2024
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
11 changes: 9 additions & 2 deletions transformers/synthetix/models/marts/core/fct_pool_rewards.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,25 @@ WITH rewards_distributed AS (
"duration"
FROM
{{ ref('core_rewards_distributed') }}
),
distributors AS (
SELECT
CAST(distributor_address AS TEXT) AS distributor_address,
CAST(token_symbol AS TEXT) AS token_symbol
FROM
{{ ref(target.name ~ '_reward_distributors') }}
)
SELECT
rd.ts,
rd.pool_id,
rd.collateral_type,
rd.distributor,
dist.token_symbol,
distributors.token_symbol,
rd.amount,
rd.ts_start,
rd.duration
FROM
rewards_distributed rd
join {{ ref(target.name ~ "_reward_distributors")}} dist on rd.distributor = dist.distributor_address
join distributors on rd.distributor = distributors.distributor_address
ORDER BY
ts
129 changes: 129 additions & 0 deletions transformers/synthetix/seeds/schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
version: 2

seeds:
# reward distributors
- name: arbitrum_mainnet_reward_distributors
description: "Mapping of reward distributor addresses to their respective reward tokens"
columns:
- name: distributor_address
description: "Address of the reward distributor contract"
meta:
type: string
tests:
- not_null
- name: token_symbol
description: "Symbol for the token received as reward"
meta:
type: string
tests:
- not_null
- name: arbitrum_sepolia_reward_distributors
description: "Mapping of reward distributor addresses to their respective reward tokens"
columns:
- name: distributor_address
description: "Address of the reward distributor contract"
meta:
type: string
tests:
- not_null
- name: token_symbol
description: "Symbol for the token received as reward"
meta:
type: string
tests:
- not_null
- name: base_mainnet_reward_distributors
description: "Mapping of reward distributor addresses to their respective reward tokens"
columns:
- name: distributor_address
description: "Address of the reward distributor contract"
meta:
type: string
tests:
- not_null
- name: token_symbol
description: "Symbol for the token received as reward"
meta:
type: string
tests:
- not_null
- name: base_sepolia_reward_distributors
description: "Mapping of reward distributor addresses to their respective reward tokens"
columns:
- name: distributor_address
description: "Address of the reward distributor contract"
meta:
type: string
tests:
- not_null
- name: token_symbol
description: "Symbol for the token received as reward"
meta:
type: string
tests:
- not_null

# tokens
- name: arbitrum_mainnet_tokens
description: "Mapping of common token addresses to their respective token symbols"
columns:
- name: token_address
description: "Address of the token contract"
meta:
type: string
tests:
- not_null
- name: token_symbol
description: "Symbol for the token"
meta:
type: string
tests:
- not_null

- name: arbitrum_sepolia_tokens
description: "Mapping of common token addresses to their respective token symbols"
columns:
- name: token_address
description: "Address of the token contract"
meta:
type: string
tests:
- not_null
- name: token_symbol
description: "Symbol for the token"
meta:
type: string
tests:
- not_null

- name: base_mainnet_tokens
description: "Mapping of common token addresses to their respective token symbols"
columns:
- name: token_address
description: "Address of the token contract"
meta:
type: string
tests:
- not_null
- name: token_symbol
description: "Symbol for the token"
meta:
type: string
tests:
- not_null

- name: base_sepolia_tokens
description: "Mapping of common token addresses to their respective token symbols"
columns:
- name: token_address
description: "Address of the token contract"
meta:
type: string
tests:
- not_null
- name: token_symbol
description: "Symbol for the token"
meta:
type: string
tests:
- not_null