Skip to content

Commit

Permalink
replace assetHolderAddress with asset
Browse files Browse the repository at this point in the history
  • Loading branch information
geoknee committed Jul 7, 2021
1 parent f194526 commit e1ea2d4
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion packages/native-utils/bench/hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const DEFAULT_STATE = {
challengeDuration: 1,
outcome: [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
allocationItems: [
{
destination:
Expand Down
2 changes: 1 addition & 1 deletion packages/native-utils/bench/recover.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const PRIVATE_KEY = '0x111111111111111111111111111111111111111111111111111111111

const OUTCOME = [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
allocationItems: [
{
destination: '0x0000000000000000000000000000000000000000000000000000000000000000',
Expand Down
2 changes: 1 addition & 1 deletion packages/native-utils/bench/sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const PRIVATE_KEY = '0x111111111111111111111111111111111111111111111111111111111

const OUTCOME = [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
allocationItems: [
{
destination: '0x0000000000000000000000000000000000000000000000000000000000000000',
Expand Down
12 changes: 6 additions & 6 deletions packages/native-utils/common/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Tokenize for AssetOutcomeType {
#[derive(Deserialize,PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct AllocationAssetOutcome {
pub asset_holder_address: Address,
pub asset: Address,
pub allocation_items: Vec<AllocationItem>,
}

Expand Down Expand Up @@ -74,7 +74,7 @@ impl Tokenize for Guarantee {
#[derive(Deserialize,PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct GuaranteeAssetOutcome {
pub asset_holder_address: Address,
pub asset: Address,
pub guarantee: Guarantee,
}

Expand All @@ -96,12 +96,12 @@ pub enum AssetOutcome {

impl Tokenize for AssetOutcome {
fn tokenize(&self) -> Token {
let (asset_holder_address, encoded) = match self {
Self::AllocationAssetOutcome(o) => (o.asset_holder_address, o.encode()),
Self::GuaranteeAssetOutcome(o) => (o.asset_holder_address, o.encode()),
let (asset, encoded) = match self {
Self::AllocationAssetOutcome(o) => (o.asset, o.encode()),
Self::GuaranteeAssetOutcome(o) => (o.asset, o.encode()),
};
Token::Tuple(vec![
asset_holder_address.tokenize(),
asset.tokenize(),
Bytes(encoded).tokenize(),
])
}
Expand Down
10 changes: 5 additions & 5 deletions packages/native-utils/tests/hash.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe('encodeOutcome', () => {
...DEFAULT_STATE,
outcome: [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
allocationItems: [
{
destination:
Expand All @@ -149,7 +149,7 @@ describe('encodeOutcome', () => {
...DEFAULT_STATE,
outcome: [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
allocationItems: [
{
destination:
Expand All @@ -174,7 +174,7 @@ describe('encodeOutcome', () => {
...DEFAULT_STATE,
outcome: [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
guarantee: {
targetChannelId:
'0x0000000000000000000000000000000000000000000000000000000000000000',
Expand Down Expand Up @@ -203,7 +203,7 @@ describe('hashOutcome', () => {
...DEFAULT_STATE,
outcome: [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
allocationItems: [
{
destination:
Expand All @@ -223,7 +223,7 @@ describe('hashOutcome', () => {
...DEFAULT_STATE,
outcome: [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
allocationItems: [
{
destination:
Expand Down
2 changes: 1 addition & 1 deletion packages/native-utils/tests/recover.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const DEFAULT_STATE: State = {
challengeDuration: 1,
outcome: [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
allocationItems: [
{
destination:
Expand Down
4 changes: 2 additions & 2 deletions packages/native-utils/tests/sign.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('Sign state', () => {
test('State with asset allocation outcome', async () => {
const outcome = [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
allocationItems: [
{
destination:
Expand Down Expand Up @@ -71,7 +71,7 @@ describe('Sign state', () => {
test('State with guarantee outcome', async () => {
const outcome = [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
guarantee: {
targetChannelId:
'0x0000000000000000000000000000000000000000000000000000000000000000',
Expand Down
4 changes: 2 additions & 2 deletions packages/native-utils/tests/transition.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as native from '..'

const OUTCOME = [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
guarantee: {
targetChannelId:
'0x0000000000000000000000000000000000000000000000000000000000000000',
Expand Down Expand Up @@ -137,7 +137,7 @@ describe('Validate state transitions', () => {
test('Outcome mismatch mismatch fails', async () => {
const otheroutcome = [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
guarantee: {
targetChannelId:
'0x0000000000000000000000000000000000000000000000000000000000000000',
Expand Down

0 comments on commit e1ea2d4

Please sign in to comment.