Skip to content

Commit

Permalink
chore: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
swimricky committed Nov 14, 2023
1 parent 8437687 commit fbea80f
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 84 deletions.
7 changes: 0 additions & 7 deletions frontend/claim_sdk/eventSubscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ export class TokenDispenserEventSubscriber {
})

const txnEvents = validTxns.map((txnLog) => {
console.log(`
signature: ${txnLog.signature}
logs: ${JSON.stringify(txnLog.logs)}
`)
const eventGen = this.eventParser.parseLogs(txnLog.logs)
const events = []
let event = eventGen.next()
Expand Down Expand Up @@ -188,10 +184,7 @@ export function formatTxnEventInfo(txnEvnInfo: TxnEventInfo) {
if (txnEvnInfo.event) {
formattedEvent = {
...formattedEvent,
...txnEvnInfo.event,
leafBuffer: txnEvnInfo.event.leafBuffer.toString('hex'),
claimant: txnEvnInfo.event.claimant.toBase58(),
claimAmount: txnEvnInfo.event.claimAmount.toNumber(),
remainingBalance: txnEvnInfo.event.remainingBalance.toNumber(),
claimInfo: txnEvnInfo.event.claimInfo,
}
Expand Down
10 changes: 0 additions & 10 deletions frontend/claim_sdk/idl/token_dispenser.json
Original file line number Diff line number Diff line change
Expand Up @@ -604,21 +604,11 @@
"type": "u64",
"index": false
},
{
"name": "claimAmount",
"type": "u64",
"index": false
},
{
"name": "claimant",
"type": "publicKey",
"index": false
},
{
"name": "leafBuffer",
"type": "bytes",
"index": false
},
{
"name": "claimInfo",
"type": {
Expand Down
20 changes: 0 additions & 20 deletions frontend/claim_sdk/idl/token_dispenser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,21 +605,11 @@ export type TokenDispenser =
"type": "u64",
"index": false
},
{
"name": "claimAmount",
"type": "u64",
"index": false
},
{
"name": "claimant",
"type": "publicKey",
"index": false
},
{
"name": "leafBuffer",
"type": "bytes",
"index": false
},
{
"name": "claimInfo",
"type": {
Expand Down Expand Up @@ -1285,21 +1275,11 @@ export const IDL: TokenDispenser =
"type": "u64",
"index": false
},
{
"name": "claimAmount",
"type": "u64",
"index": false
},
{
"name": "claimant",
"type": "publicKey",
"index": false
},
{
"name": "leafBuffer",
"type": "bytes",
"index": false
},
{
"name": "claimInfo",
"type": {
Expand Down
10 changes: 4 additions & 6 deletions frontend/integration/integrationTest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ describe('integration test', () => {
},
})
expect(
new anchor.BN(evmClaimEvent.claimAmount.toString()).eq(claimInfo.amount)
new anchor.BN(evmClaimEvent.claimInfo.amount.toString()).eq(
claimInfo.amount
)
).toBeTruthy()
expectedTreasuryBalance = expectedTreasuryBalance.sub(claimInfo.amount)
const eventRemainingBalance = new anchor.BN(
Expand All @@ -229,8 +231,6 @@ describe('integration test', () => {
expectedTreasuryBalance
)
).toBeTruthy()
const expectedLeafBuffer = claimInfo.toBuffer()
expect(evmClaimEvent.leafBuffer).toEqual(expectedLeafBuffer)
}, 40000)

it('submits a cosmwasm claim', async () => {
Expand Down Expand Up @@ -279,7 +279,7 @@ describe('integration test', () => {
cosmwasm: { address: testWallets.cosmwasm[0].address() },
})
expect(
new anchor.BN(cosmClaimEvent.claimAmount.toString()).eq(
new anchor.BN(cosmClaimEvent.claimInfo.amount.toString()).eq(
claimInfo.amount
)
).toBeTruthy()
Expand All @@ -289,8 +289,6 @@ describe('integration test', () => {
expectedTreasuryBalance
)
).toBeTruthy()
const expectedLeafBuffer = claimInfo.toBuffer()
expect(cosmClaimEvent.leafBuffer).toEqual(expectedLeafBuffer)
}, 40000)

it('submits multiple claims at once', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ pub struct AptosAddress([u8; 32]);

impl AptosAddress {
pub const LEN: usize = 32;

pub fn as_bytes(&self) -> [u8; Self::LEN] {
self.0
}
}

impl From<Ed25519Pubkey> for AptosAddress {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,6 @@ impl From<[u8; Self::LEN]> for UncompressedSecp256k1Pubkey {
#[derive(AnchorDeserialize, AnchorSerialize, Clone, Debug)]
pub struct CosmosBech32Address(String);

impl CosmosBech32Address {
pub fn as_string(&self) -> String {
self.0.to_owned()
}
}

impl From<EvmPubkey> for CosmosBech32Address {
fn from(value: EvmPubkey) -> Self {
CosmosBech32Address(
Expand Down
31 changes: 0 additions & 31 deletions token-dispenser/programs/token-dispenser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,7 @@ pub mod token_dispenser {

emit!(ClaimEvent {
remaining_balance: treasury.amount,
claim_amount: claim_info.amount,
claimant: *ctx.accounts.claimant.key,
leaf_buffer: leaf_vector,
claim_info,
});

Expand Down Expand Up @@ -260,33 +258,6 @@ pub enum Identity {
Injective { address: CosmosBech32Address },
}

// impl Identity {
// fn ecosystem(&self) -> String {
// let ecosystem = match self {
// Identity::Discord { .. } => "discord",
// Identity::Solana { .. } => "solana",
// Identity::Evm { .. } => "evm",
// Identity::Sui { .. } => "sui",
// Identity::Aptos { .. } => "aptos",
// Identity::Cosmwasm { .. } => "cosmwasm",
// Identity::Injective { .. } => "injective",
// };
// ecosystem.to_owned()
// }
//
// fn address(&self) -> String {
// match self {
// Identity::Discord { username } => username.to_string(),
// Identity::Solana { pubkey } => Pubkey::from(pubkey.to_bytes()).to_string(),
// Identity::Evm { pubkey } => hex::encode(pubkey.as_bytes()),
// Identity::Sui { address } => hex::encode(address.as_bytes()),
// Identity::Aptos { address } => hex::encode(address.as_bytes()),
// Identity::Cosmwasm { address } => address.as_string(),
// Identity::Injective { address } => address.as_string(),
// }
// }
// }

#[derive(AnchorDeserialize, AnchorSerialize, Clone)]
pub enum IdentityCertificate {
Discord {
Expand Down Expand Up @@ -683,8 +654,6 @@ impl crate::accounts::Claim {
#[event]
pub struct ClaimEvent {
pub remaining_balance: u64,
pub claim_amount: u64,
pub claimant: Pubkey,
pub leaf_buffer: Vec<u8>,
pub claim_info: ClaimInfo,
}

0 comments on commit fbea80f

Please sign in to comment.