diff --git a/cadence/args/deploy-factory-args.json b/cadence/args/deploy-factory-args.json index b89fe17c..512e101b 100644 --- a/cadence/args/deploy-factory-args.json +++ b/cadence/args/deploy-factory-args.json @@ -1,7 +1,7 @@ [ { "type": "String", - "value": "608060405234801561001057600080fd5b50338061003757604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61004081610046565b50610096565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611414806100a56000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80638da5cb5b11610097578063daa09e5411610066578063daa09e54146101f8578063db6d56cd1461020b578063dfe1ac361461021e578063f2fde38b1461023157600080fd5b80638da5cb5b146101a1578063aff51c3e146101b2578063b3d5dbdc146101c5578063d974d238146101e557600080fd5b80635ab1bd53116100d35780635ab1bd531461016257806366cd501414610173578063715018a61461018657806383843c9e1461018e57600080fd5b806304433bbc146100fa57806314902ad31461012a578063263e0c1b1461013f575b600080fd5b61010d610108366004611029565b610244565b6040516001600160a01b0390911681526020015b60405180910390f35b61013d61013836600461107b565b6102bc565b005b61015261014d36600461107b565b610336565b6040519015158152602001610121565b6001546001600160a01b031661010d565b61010d610181366004611029565b610726565b61013d610757565b61013d61019c366004611029565b61076b565b6000546001600160a01b031661010d565b61013d6101c0366004611098565b61086d565b6101d86101d336600461107b565b610986565b604051610121919061113a565b61013d6101f3366004611098565b6109f9565b61015261020636600461107b565b610aca565b61010d61021936600461114d565b610b40565b61015261022c36600461107b565b610c15565b61013d61023f36600461107b565b610c84565b600154604051630110ceef60e21b81526000916001600160a01b0316906304433bbc9061027590859060040161113a565b602060405180830381865afa158015610292573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b69190611242565b92915050565b6102c4610cc2565b6102cd81610cef565b600154604080516001600160a01b03928316815291831660208301527f61dad6e94cd5c0b65c9265246706a09bd0d11d5330f3e6b659d328151a664e8c910160405180910390a1600180546001600160a01b0319166001600160a01b0392909216919091179055565b60408051600481526024810182526020810180516001600160e01b03166318160ddd60e01b1790529051600091829182916001600160a01b0386169161037c919061125f565b600060405180830381855afa9150503d80600081146103b7576040519150601f19603f3d011682016040523d82523d6000602084013e6103bc565b606091505b50915091508115806103cd57508051155b156103dc575060009392505050565b604051600060248201526001600160a01b0385169060440160408051601f198184030181529181526020820180516001600160e01b03166370a0823160e01b17905251610429919061125f565b600060405180830381855afa9150503d8060008114610464576040519150601f19603f3d011682016040523d82523d6000602084013e610469565b606091505b50909250905081158061047b57508051155b1561048a575060009392505050565b60405160006024820181905260448201526001600160a01b0385169060640160408051601f198184030181529181526020820180516001600160e01b0316636eb1769f60e11b179052516104de919061125f565b600060405180830381855afa9150503d8060008114610519576040519150601f19603f3d011682016040523d82523d6000602084013e61051e565b606091505b50909250905081158061053057508051155b1561053f575060009392505050565b60408051600481526024810182526020810180516001600160e01b03166306fdde0360e01b17905290516001600160a01b0386169161057d9161125f565b600060405180830381855afa9150503d80600081146105b8576040519150601f19603f3d011682016040523d82523d6000602084013e6105bd565b606091505b5090925090508115806105cf57508051155b156105de575060009392505050565b60408051600481526024810182526020810180516001600160e01b03166395d89b4160e01b17905290516001600160a01b0386169161061c9161125f565b600060405180830381855afa9150503d8060008114610657576040519150601f19603f3d011682016040523d82523d6000602084013e61065c565b606091505b50909250905081158061066e57508051155b1561067d575060009392505050565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b17905290516001600160a01b038616916106bb9161125f565b600060405180830381855afa9150503d80600081146106f6576040519150601f19603f3d011682016040523d82523d6000602084013e6106fb565b606091505b50909250905081158061070d57508051155b1561071c575060009392505050565b5060019392505050565b6000600282604051610738919061125f565b908152604051908190036020019020546001600160a01b031692915050565b61075f610cc2565b6107696000610d61565b565b610773610cc2565b6000600282604051610785919061125f565b908152604051908190036020019020546001600160a01b03169050806108055760405162461bcd60e51b815260206004820152602a60248201527f466c6f77427269646765466163746f72793a204465706c6f796572206e6f74206044820152691c9959da5cdd195c995960b21b60648201526084015b60405180910390fd5b600282604051610815919061125f565b90815260405190819003602001812080546001600160a01b03191690557f03c7566b5f4959b890c1a6d38f39df053c6737c9965d9c0ddf612c86100a838b90610861908490849061127b565b60405180910390a15050565b610875610cc2565b61087e81610db1565b60006001600160a01b0316600283604051610899919061125f565b908152604051908190036020019020546001600160a01b0316146109165760405162461bcd60e51b815260206004820152602e60248201527f466c6f77427269646765466163746f72793a204465706c6f79657220616c726560448201526d18591e481c9959da5cdd195c995960921b60648201526084016107fc565b80600283604051610927919061125f565b90815260405190819003602001812080546001600160a01b03939093166001600160a01b0319909316929092179091557fc0c30f085f0b1397c8bf23f8b851b63b33e13d11832b8320a37fca1c07dcb40f90610861908490849061127b565b600154604051632cf576f760e21b81526001600160a01b038381166004830152606092169063b3d5dbdc90602401600060405180830381865afa1580156109d1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102b691908101906112a5565b610a01610cc2565b610a0a81610db1565b6000600283604051610a1c919061125f565b908152604051908190036020019020546001600160a01b0316905080610a4b57610a46838361086d565b505050565b81600284604051610a5c919061125f565b90815260405190819003602001812080546001600160a01b03939093166001600160a01b0319909316929092179091557f848576f8a081c5af60d89f0215c8af528186670eefd6349c05014d5b2268864690610abd9085908490869061131c565b60405180910390a1505050565b6040516301ffc9a760e01b81526380ac58cd60e01b60048201526000906001600160a01b038316906301ffc9a790602401602060405180830381865afa925050508015610b34575060408051601f3d908101601f19168201909252610b319181019061134f565b60015b6102b657506000919050565b6000610b4a610cc2565b6000600288604051610b5c919061125f565b908152604051908190036020019020546001600160a01b03169050610b8081610db1565b60405163476d399760e01b815281906000906001600160a01b0383169063476d399790610bb9908c908c908c908c908c90600401611371565b6020604051808303816000875af1158015610bd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfc9190611242565b9050610c088682610e23565b9998505050505050505050565b60015460405163a6de610560e01b81526001600160a01b038381166004830152600092169063a6de610590602401602060405180830381865afa158015610c60573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b6919061134f565b610c8c610cc2565b6001600160a01b038116610cb657604051631e4fbdf760e01b8152600060048201526024016107fc565b610cbf81610d61565b50565b6000546001600160a01b031633146107695760405163118cdaa760e01b81523360048201526024016107fc565b610cf881610e8e565b610d098163976998cb60e01b610ee4565b610cbf5760405162461bcd60e51b815260206004820152602360248201527f466c6f77427269646765466163746f72793a20496e76616c696420726567697360448201526274727960e81b60648201526084016107fc565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610dba81610e8e565b610dcb8163476d399760e01b610ee4565b610cbf5760405162461bcd60e51b815260206004820152602360248201527f466c6f77427269646765466163746f72793a20496e76616c6964206465706c6f6044820152623cb2b960e91b60648201526084016107fc565b60015460405163522791d160e01b81526001600160a01b0390911690819063522791d190610e57908690869060040161127b565b600060405180830381600087803b158015610e7157600080fd5b505af1158015610e85573d6000803e3d6000fd5b50505050505050565b6001600160a01b038116610cbf5760405162461bcd60e51b815260206004820152601f60248201527f466c6f77427269646765466163746f72793a205a65726f20616464726573730060448201526064016107fc565b6040516301ffc9a760e01b81526001600160e01b0319821660048201526000906001600160a01b038416906301ffc9a790602401602060405180830381865afa925050508015610f51575060408051601f3d908101601f19168201909252610f4e9181019061134f565b60015b610f5d575060006102b6565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610fa357610fa3610f64565b604052919050565b600067ffffffffffffffff821115610fc557610fc5610f64565b50601f01601f191660200190565b600082601f830112610fe457600080fd5b8135610ff7610ff282610fab565b610f7a565b81815284602083860101111561100c57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561103b57600080fd5b813567ffffffffffffffff81111561105257600080fd5b61105e84828501610fd3565b949350505050565b6001600160a01b0381168114610cbf57600080fd5b60006020828403121561108d57600080fd5b8135610f5d81611066565b600080604083850312156110ab57600080fd5b823567ffffffffffffffff8111156110c257600080fd5b6110ce85828601610fd3565b92505060208301356110df81611066565b809150509250929050565b60005b838110156111055781810151838201526020016110ed565b50506000910152565b600081518084526111268160208601602086016110ea565b601f01601f19169290920160200192915050565b602081526000610f5d602083018461110e565b60008060008060008060c0878903121561116657600080fd5b863567ffffffffffffffff8082111561117e57600080fd5b61118a8a838b01610fd3565b975060208901359150808211156111a057600080fd5b6111ac8a838b01610fd3565b965060408901359150808211156111c257600080fd5b6111ce8a838b01610fd3565b955060608901359150808211156111e457600080fd5b6111f08a838b01610fd3565b9450608089013591508082111561120657600080fd5b6112128a838b01610fd3565b935060a089013591508082111561122857600080fd5b5061123589828a01610fd3565b9150509295509295509295565b60006020828403121561125457600080fd5b8151610f5d81611066565b600082516112718184602087016110ea565b9190910192915050565b60408152600061128e604083018561110e565b905060018060a01b03831660208301529392505050565b6000602082840312156112b757600080fd5b815167ffffffffffffffff8111156112ce57600080fd5b8201601f810184136112df57600080fd5b80516112ed610ff282610fab565b81815285602083850101111561130257600080fd5b6113138260208301602086016110ea565b95945050505050565b60608152600061132f606083018661110e565b6001600160a01b0394851660208401529290931660409091015292915050565b60006020828403121561136157600080fd5b81518015158114610f5d57600080fd5b60a08152600061138460a083018861110e565b8281036020840152611396818861110e565b905082810360408401526113aa818761110e565b905082810360608401526113be818661110e565b905082810360808401526113d2818561110e565b9897505050505050505056fea2646970667358221220f24c72179ae52649db9edfc49327676600f6548bf80be2ac1838fbfaf00f29af64736f6c63430008170033" + "value": "608060405234801561001057600080fd5b50338061003757604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61004081610046565b50610096565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611452806100a56000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c8063aff51c3e11610097578063daa09e5411610066578063daa09e5414610216578063db6d56cd14610229578063dfe1ac361461023c578063f2fde38b1461024f57600080fd5b8063aff51c3e146101bd578063b3d5dbdc146101d0578063cc435bf3146101f0578063d974d2381461020357600080fd5b806366cd5014116100d357806366cd50141461017e578063715018a61461019157806383843c9e146101995780638da5cb5b146101ac57600080fd5b806304433bbc1461010557806314902ad314610135578063263e0c1b1461014a5780635ab1bd531461016d575b600080fd5b610118610113366004611067565b610262565b6040516001600160a01b0390911681526020015b60405180910390f35b6101486101433660046110b9565b6102da565b005b61015d6101583660046110b9565b610354565b604051901515815260200161012c565b6001546001600160a01b0316610118565b61011861018c366004611067565b610744565b610148610775565b6101486101a7366004611067565b610789565b6000546001600160a01b0316610118565b6101486101cb3660046110d6565b61088b565b6101e36101de3660046110b9565b6109a4565b60405161012c9190611178565b61015d6101fe3660046110b9565b610a17565b6101486102113660046110d6565b610a37565b61015d6102243660046110b9565b610b08565b61011861023736600461118b565b610b7e565b61015d61024a3660046110b9565b610c53565b61014861025d3660046110b9565b610cc2565b600154604051630110ceef60e21b81526000916001600160a01b0316906304433bbc90610293908590600401611178565b602060405180830381865afa1580156102b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d49190611280565b92915050565b6102e2610d00565b6102eb81610d2d565b600154604080516001600160a01b03928316815291831660208301527f61dad6e94cd5c0b65c9265246706a09bd0d11d5330f3e6b659d328151a664e8c910160405180910390a1600180546001600160a01b0319166001600160a01b0392909216919091179055565b60408051600481526024810182526020810180516001600160e01b03166318160ddd60e01b1790529051600091829182916001600160a01b0386169161039a919061129d565b600060405180830381855afa9150503d80600081146103d5576040519150601f19603f3d011682016040523d82523d6000602084013e6103da565b606091505b50915091508115806103eb57508051155b156103fa575060009392505050565b604051600060248201526001600160a01b0385169060440160408051601f198184030181529181526020820180516001600160e01b03166370a0823160e01b17905251610447919061129d565b600060405180830381855afa9150503d8060008114610482576040519150601f19603f3d011682016040523d82523d6000602084013e610487565b606091505b50909250905081158061049957508051155b156104a8575060009392505050565b60405160006024820181905260448201526001600160a01b0385169060640160408051601f198184030181529181526020820180516001600160e01b0316636eb1769f60e11b179052516104fc919061129d565b600060405180830381855afa9150503d8060008114610537576040519150601f19603f3d011682016040523d82523d6000602084013e61053c565b606091505b50909250905081158061054e57508051155b1561055d575060009392505050565b60408051600481526024810182526020810180516001600160e01b03166306fdde0360e01b17905290516001600160a01b0386169161059b9161129d565b600060405180830381855afa9150503d80600081146105d6576040519150601f19603f3d011682016040523d82523d6000602084013e6105db565b606091505b5090925090508115806105ed57508051155b156105fc575060009392505050565b60408051600481526024810182526020810180516001600160e01b03166395d89b4160e01b17905290516001600160a01b0386169161063a9161129d565b600060405180830381855afa9150503d8060008114610675576040519150601f19603f3d011682016040523d82523d6000602084013e61067a565b606091505b50909250905081158061068c57508051155b1561069b575060009392505050565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b17905290516001600160a01b038616916106d99161129d565b600060405180830381855afa9150503d8060008114610714576040519150601f19603f3d011682016040523d82523d6000602084013e610719565b606091505b50909250905081158061072b57508051155b1561073a575060009392505050565b5060019392505050565b6000600282604051610756919061129d565b908152604051908190036020019020546001600160a01b031692915050565b61077d610d00565b6107876000610d9f565b565b610791610d00565b60006002826040516107a3919061129d565b908152604051908190036020019020546001600160a01b03169050806108235760405162461bcd60e51b815260206004820152602a60248201527f466c6f77427269646765466163746f72793a204465706c6f796572206e6f74206044820152691c9959da5cdd195c995960b21b60648201526084015b60405180910390fd5b600282604051610833919061129d565b90815260405190819003602001812080546001600160a01b03191690557f03c7566b5f4959b890c1a6d38f39df053c6737c9965d9c0ddf612c86100a838b9061087f90849084906112b9565b60405180910390a15050565b610893610d00565b61089c81610def565b60006001600160a01b03166002836040516108b7919061129d565b908152604051908190036020019020546001600160a01b0316146109345760405162461bcd60e51b815260206004820152602e60248201527f466c6f77427269646765466163746f72793a204465706c6f79657220616c726560448201526d18591e481c9959da5cdd195c995960921b606482015260840161081a565b80600283604051610945919061129d565b90815260405190819003602001812080546001600160a01b03939093166001600160a01b0319909316929092179091557fc0c30f085f0b1397c8bf23f8b851b63b33e13d11832b8320a37fca1c07dcb40f9061087f90849084906112b9565b600154604051632cf576f760e21b81526001600160a01b038381166004830152606092169063b3d5dbdc90602401600060405180830381865afa1580156109ef573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102d491908101906112e3565b6000610a2282610b08565b1515610a2d83610354565b1515141592915050565b610a3f610d00565b610a4881610def565b6000600283604051610a5a919061129d565b908152604051908190036020019020546001600160a01b0316905080610a8957610a84838361088b565b505050565b81600284604051610a9a919061129d565b90815260405190819003602001812080546001600160a01b03939093166001600160a01b0319909316929092179091557f848576f8a081c5af60d89f0215c8af528186670eefd6349c05014d5b2268864690610afb9085908490869061135a565b60405180910390a1505050565b6040516301ffc9a760e01b81526380ac58cd60e01b60048201526000906001600160a01b038316906301ffc9a790602401602060405180830381865afa925050508015610b72575060408051601f3d908101601f19168201909252610b6f9181019061138d565b60015b6102d457506000919050565b6000610b88610d00565b6000600288604051610b9a919061129d565b908152604051908190036020019020546001600160a01b03169050610bbe81610def565b60405163476d399760e01b815281906000906001600160a01b0383169063476d399790610bf7908c908c908c908c908c906004016113af565b6020604051808303816000875af1158015610c16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3a9190611280565b9050610c468682610e61565b9998505050505050505050565b60015460405163a6de610560e01b81526001600160a01b038381166004830152600092169063a6de610590602401602060405180830381865afa158015610c9e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d4919061138d565b610cca610d00565b6001600160a01b038116610cf457604051631e4fbdf760e01b81526000600482015260240161081a565b610cfd81610d9f565b50565b6000546001600160a01b031633146107875760405163118cdaa760e01b815233600482015260240161081a565b610d3681610ecc565b610d478163976998cb60e01b610f22565b610cfd5760405162461bcd60e51b815260206004820152602360248201527f466c6f77427269646765466163746f72793a20496e76616c696420726567697360448201526274727960e81b606482015260840161081a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610df881610ecc565b610e098163476d399760e01b610f22565b610cfd5760405162461bcd60e51b815260206004820152602360248201527f466c6f77427269646765466163746f72793a20496e76616c6964206465706c6f6044820152623cb2b960e91b606482015260840161081a565b60015460405163522791d160e01b81526001600160a01b0390911690819063522791d190610e9590869086906004016112b9565b600060405180830381600087803b158015610eaf57600080fd5b505af1158015610ec3573d6000803e3d6000fd5b50505050505050565b6001600160a01b038116610cfd5760405162461bcd60e51b815260206004820152601f60248201527f466c6f77427269646765466163746f72793a205a65726f206164647265737300604482015260640161081a565b6040516301ffc9a760e01b81526001600160e01b0319821660048201526000906001600160a01b038416906301ffc9a790602401602060405180830381865afa925050508015610f8f575060408051601f3d908101601f19168201909252610f8c9181019061138d565b60015b610f9b575060006102d4565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610fe157610fe1610fa2565b604052919050565b600067ffffffffffffffff82111561100357611003610fa2565b50601f01601f191660200190565b600082601f83011261102257600080fd5b813561103561103082610fe9565b610fb8565b81815284602083860101111561104a57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561107957600080fd5b813567ffffffffffffffff81111561109057600080fd5b61109c84828501611011565b949350505050565b6001600160a01b0381168114610cfd57600080fd5b6000602082840312156110cb57600080fd5b8135610f9b816110a4565b600080604083850312156110e957600080fd5b823567ffffffffffffffff81111561110057600080fd5b61110c85828601611011565b925050602083013561111d816110a4565b809150509250929050565b60005b8381101561114357818101518382015260200161112b565b50506000910152565b60008151808452611164816020860160208601611128565b601f01601f19169290920160200192915050565b602081526000610f9b602083018461114c565b60008060008060008060c087890312156111a457600080fd5b863567ffffffffffffffff808211156111bc57600080fd5b6111c88a838b01611011565b975060208901359150808211156111de57600080fd5b6111ea8a838b01611011565b9650604089013591508082111561120057600080fd5b61120c8a838b01611011565b9550606089013591508082111561122257600080fd5b61122e8a838b01611011565b9450608089013591508082111561124457600080fd5b6112508a838b01611011565b935060a089013591508082111561126657600080fd5b5061127389828a01611011565b9150509295509295509295565b60006020828403121561129257600080fd5b8151610f9b816110a4565b600082516112af818460208701611128565b9190910192915050565b6040815260006112cc604083018561114c565b905060018060a01b03831660208301529392505050565b6000602082840312156112f557600080fd5b815167ffffffffffffffff81111561130c57600080fd5b8201601f8101841361131d57600080fd5b805161132b61103082610fe9565b81815285602083850101111561134057600080fd5b611351826020830160208601611128565b95945050505050565b60608152600061136d606083018661114c565b6001600160a01b0394851660208401529290931660409091015292915050565b60006020828403121561139f57600080fd5b81518015158114610f9b57600080fd5b60a0815260006113c260a083018861114c565b82810360208401526113d4818861114c565b905082810360408401526113e8818761114c565b905082810360608401526113fc818661114c565b90508281036080840152611410818561114c565b9897505050505050505056fea264697066735822122026be7d4ef13534833344abdcc736e8876603e1f9d3463f0047ddca092a98cc2d64736f6c63430008170033" }, { "type": "UInt64", diff --git a/cadence/contracts/bridge/FlowEVMBridgeUtils.cdc b/cadence/contracts/bridge/FlowEVMBridgeUtils.cdc index ed3522d9..4d27c2d6 100644 --- a/cadence/contracts/bridge/FlowEVMBridgeUtils.cdc +++ b/cadence/contracts/bridge/FlowEVMBridgeUtils.cdc @@ -256,9 +256,16 @@ contract FlowEVMBridgeUtils { /// access(all) fun isValidEVMAsset(evmContractAddress: EVM.EVMAddress): Bool { - let isERC721 = self.isERC721(evmContractAddress: evmContractAddress) - let isERC20 = self.isERC20(evmContractAddress: evmContractAddress) - return (isERC721 && !isERC20) || (!isERC721 && isERC20) + let callResult = self.call( + signature: "isValidAsset(address)", + targetEVMAddress: self.bridgeFactoryEVMAddress, + args: [evmContractAddress], + gasLimit: 100000, + value: 0.0 + ) + let decodedResult = EVM.decodeABI(types: [Type()], data: callResult.data) + assert(decodedResult.length == 1, message: "Invalid response length") + return decodedResult[0] as! Bool } /// Returns whether the given type is either an NFT or FT exclusively @@ -271,7 +278,7 @@ contract FlowEVMBridgeUtils { view fun isValidFlowAsset(type: Type): Bool { let isFlowNFT = type.isSubtype(of: Type<@{NonFungibleToken.NFT}>()) let isFlowToken = type.isSubtype(of: Type<@{FungibleToken.Vault}>()) - return (isFlowNFT && !isFlowToken) || (!isFlowNFT && isFlowToken) + return isFlowNFT != isFlowToken } /// Retrieves the bridge contract's COA EVMAddress diff --git a/cadence/tests/flow_evm_bridge_utils_tests.cdc b/cadence/tests/flow_evm_bridge_utils_tests.cdc index a4ca6687..aeae6a47 100644 --- a/cadence/tests/flow_evm_bridge_utils_tests.cdc +++ b/cadence/tests/flow_evm_bridge_utils_tests.cdc @@ -96,12 +96,11 @@ fun setup() { ) let evts = Test.eventsOfType(Type()) Test.assertEqual(2, evts.length) - let factoryDeploymentEvent = evts[0] as! EVM.TransactionExecuted - let factoryAddressHex = factoryDeploymentEvent.contractAddress + let factoryAddressHex = getEVMAddressHexFromEvents(evts, idx: 0) err = Test.deployContract( name: "FlowEVMBridgeUtils", path: "../contracts/bridge/FlowEVMBridgeUtils.cdc", - arguments: [factoryAddressHex.slice(from: 2, upTo: factoryAddressHex.length)] + arguments: [factoryAddressHex] ) Test.expect(err, Test.beNil()) } diff --git a/cadence/tests/test_helpers.cdc b/cadence/tests/test_helpers.cdc index e71ffe2e..5d732366 100644 --- a/cadence/tests/test_helpers.cdc +++ b/cadence/tests/test_helpers.cdc @@ -11,7 +11,7 @@ import "EVM" /// See the python util `get_code_hex.py` to retrieve the hex-encoded Cadence either with or /// without a separator (`{{CONTRACT_NAME}}` used in templates to "chunk" template code). -access(all) let compiledFactoryBytecode = "608060405234801561001057600080fd5b50338061003757604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61004081610046565b50610096565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611414806100a56000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80638da5cb5b11610097578063daa09e5411610066578063daa09e54146101f8578063db6d56cd1461020b578063dfe1ac361461021e578063f2fde38b1461023157600080fd5b80638da5cb5b146101a1578063aff51c3e146101b2578063b3d5dbdc146101c5578063d974d238146101e557600080fd5b80635ab1bd53116100d35780635ab1bd531461016257806366cd501414610173578063715018a61461018657806383843c9e1461018e57600080fd5b806304433bbc146100fa57806314902ad31461012a578063263e0c1b1461013f575b600080fd5b61010d610108366004611029565b610244565b6040516001600160a01b0390911681526020015b60405180910390f35b61013d61013836600461107b565b6102bc565b005b61015261014d36600461107b565b610336565b6040519015158152602001610121565b6001546001600160a01b031661010d565b61010d610181366004611029565b610726565b61013d610757565b61013d61019c366004611029565b61076b565b6000546001600160a01b031661010d565b61013d6101c0366004611098565b61086d565b6101d86101d336600461107b565b610986565b604051610121919061113a565b61013d6101f3366004611098565b6109f9565b61015261020636600461107b565b610aca565b61010d61021936600461114d565b610b40565b61015261022c36600461107b565b610c15565b61013d61023f36600461107b565b610c84565b600154604051630110ceef60e21b81526000916001600160a01b0316906304433bbc9061027590859060040161113a565b602060405180830381865afa158015610292573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b69190611242565b92915050565b6102c4610cc2565b6102cd81610cef565b600154604080516001600160a01b03928316815291831660208301527f61dad6e94cd5c0b65c9265246706a09bd0d11d5330f3e6b659d328151a664e8c910160405180910390a1600180546001600160a01b0319166001600160a01b0392909216919091179055565b60408051600481526024810182526020810180516001600160e01b03166318160ddd60e01b1790529051600091829182916001600160a01b0386169161037c919061125f565b600060405180830381855afa9150503d80600081146103b7576040519150601f19603f3d011682016040523d82523d6000602084013e6103bc565b606091505b50915091508115806103cd57508051155b156103dc575060009392505050565b604051600060248201526001600160a01b0385169060440160408051601f198184030181529181526020820180516001600160e01b03166370a0823160e01b17905251610429919061125f565b600060405180830381855afa9150503d8060008114610464576040519150601f19603f3d011682016040523d82523d6000602084013e610469565b606091505b50909250905081158061047b57508051155b1561048a575060009392505050565b60405160006024820181905260448201526001600160a01b0385169060640160408051601f198184030181529181526020820180516001600160e01b0316636eb1769f60e11b179052516104de919061125f565b600060405180830381855afa9150503d8060008114610519576040519150601f19603f3d011682016040523d82523d6000602084013e61051e565b606091505b50909250905081158061053057508051155b1561053f575060009392505050565b60408051600481526024810182526020810180516001600160e01b03166306fdde0360e01b17905290516001600160a01b0386169161057d9161125f565b600060405180830381855afa9150503d80600081146105b8576040519150601f19603f3d011682016040523d82523d6000602084013e6105bd565b606091505b5090925090508115806105cf57508051155b156105de575060009392505050565b60408051600481526024810182526020810180516001600160e01b03166395d89b4160e01b17905290516001600160a01b0386169161061c9161125f565b600060405180830381855afa9150503d8060008114610657576040519150601f19603f3d011682016040523d82523d6000602084013e61065c565b606091505b50909250905081158061066e57508051155b1561067d575060009392505050565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b17905290516001600160a01b038616916106bb9161125f565b600060405180830381855afa9150503d80600081146106f6576040519150601f19603f3d011682016040523d82523d6000602084013e6106fb565b606091505b50909250905081158061070d57508051155b1561071c575060009392505050565b5060019392505050565b6000600282604051610738919061125f565b908152604051908190036020019020546001600160a01b031692915050565b61075f610cc2565b6107696000610d61565b565b610773610cc2565b6000600282604051610785919061125f565b908152604051908190036020019020546001600160a01b03169050806108055760405162461bcd60e51b815260206004820152602a60248201527f466c6f77427269646765466163746f72793a204465706c6f796572206e6f74206044820152691c9959da5cdd195c995960b21b60648201526084015b60405180910390fd5b600282604051610815919061125f565b90815260405190819003602001812080546001600160a01b03191690557f03c7566b5f4959b890c1a6d38f39df053c6737c9965d9c0ddf612c86100a838b90610861908490849061127b565b60405180910390a15050565b610875610cc2565b61087e81610db1565b60006001600160a01b0316600283604051610899919061125f565b908152604051908190036020019020546001600160a01b0316146109165760405162461bcd60e51b815260206004820152602e60248201527f466c6f77427269646765466163746f72793a204465706c6f79657220616c726560448201526d18591e481c9959da5cdd195c995960921b60648201526084016107fc565b80600283604051610927919061125f565b90815260405190819003602001812080546001600160a01b03939093166001600160a01b0319909316929092179091557fc0c30f085f0b1397c8bf23f8b851b63b33e13d11832b8320a37fca1c07dcb40f90610861908490849061127b565b600154604051632cf576f760e21b81526001600160a01b038381166004830152606092169063b3d5dbdc90602401600060405180830381865afa1580156109d1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102b691908101906112a5565b610a01610cc2565b610a0a81610db1565b6000600283604051610a1c919061125f565b908152604051908190036020019020546001600160a01b0316905080610a4b57610a46838361086d565b505050565b81600284604051610a5c919061125f565b90815260405190819003602001812080546001600160a01b03939093166001600160a01b0319909316929092179091557f848576f8a081c5af60d89f0215c8af528186670eefd6349c05014d5b2268864690610abd9085908490869061131c565b60405180910390a1505050565b6040516301ffc9a760e01b81526380ac58cd60e01b60048201526000906001600160a01b038316906301ffc9a790602401602060405180830381865afa925050508015610b34575060408051601f3d908101601f19168201909252610b319181019061134f565b60015b6102b657506000919050565b6000610b4a610cc2565b6000600288604051610b5c919061125f565b908152604051908190036020019020546001600160a01b03169050610b8081610db1565b60405163476d399760e01b815281906000906001600160a01b0383169063476d399790610bb9908c908c908c908c908c90600401611371565b6020604051808303816000875af1158015610bd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfc9190611242565b9050610c088682610e23565b9998505050505050505050565b60015460405163a6de610560e01b81526001600160a01b038381166004830152600092169063a6de610590602401602060405180830381865afa158015610c60573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b6919061134f565b610c8c610cc2565b6001600160a01b038116610cb657604051631e4fbdf760e01b8152600060048201526024016107fc565b610cbf81610d61565b50565b6000546001600160a01b031633146107695760405163118cdaa760e01b81523360048201526024016107fc565b610cf881610e8e565b610d098163976998cb60e01b610ee4565b610cbf5760405162461bcd60e51b815260206004820152602360248201527f466c6f77427269646765466163746f72793a20496e76616c696420726567697360448201526274727960e81b60648201526084016107fc565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610dba81610e8e565b610dcb8163476d399760e01b610ee4565b610cbf5760405162461bcd60e51b815260206004820152602360248201527f466c6f77427269646765466163746f72793a20496e76616c6964206465706c6f6044820152623cb2b960e91b60648201526084016107fc565b60015460405163522791d160e01b81526001600160a01b0390911690819063522791d190610e57908690869060040161127b565b600060405180830381600087803b158015610e7157600080fd5b505af1158015610e85573d6000803e3d6000fd5b50505050505050565b6001600160a01b038116610cbf5760405162461bcd60e51b815260206004820152601f60248201527f466c6f77427269646765466163746f72793a205a65726f20616464726573730060448201526064016107fc565b6040516301ffc9a760e01b81526001600160e01b0319821660048201526000906001600160a01b038416906301ffc9a790602401602060405180830381865afa925050508015610f51575060408051601f3d908101601f19168201909252610f4e9181019061134f565b60015b610f5d575060006102b6565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610fa357610fa3610f64565b604052919050565b600067ffffffffffffffff821115610fc557610fc5610f64565b50601f01601f191660200190565b600082601f830112610fe457600080fd5b8135610ff7610ff282610fab565b610f7a565b81815284602083860101111561100c57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561103b57600080fd5b813567ffffffffffffffff81111561105257600080fd5b61105e84828501610fd3565b949350505050565b6001600160a01b0381168114610cbf57600080fd5b60006020828403121561108d57600080fd5b8135610f5d81611066565b600080604083850312156110ab57600080fd5b823567ffffffffffffffff8111156110c257600080fd5b6110ce85828601610fd3565b92505060208301356110df81611066565b809150509250929050565b60005b838110156111055781810151838201526020016110ed565b50506000910152565b600081518084526111268160208601602086016110ea565b601f01601f19169290920160200192915050565b602081526000610f5d602083018461110e565b60008060008060008060c0878903121561116657600080fd5b863567ffffffffffffffff8082111561117e57600080fd5b61118a8a838b01610fd3565b975060208901359150808211156111a057600080fd5b6111ac8a838b01610fd3565b965060408901359150808211156111c257600080fd5b6111ce8a838b01610fd3565b955060608901359150808211156111e457600080fd5b6111f08a838b01610fd3565b9450608089013591508082111561120657600080fd5b6112128a838b01610fd3565b935060a089013591508082111561122857600080fd5b5061123589828a01610fd3565b9150509295509295509295565b60006020828403121561125457600080fd5b8151610f5d81611066565b600082516112718184602087016110ea565b9190910192915050565b60408152600061128e604083018561110e565b905060018060a01b03831660208301529392505050565b6000602082840312156112b757600080fd5b815167ffffffffffffffff8111156112ce57600080fd5b8201601f810184136112df57600080fd5b80516112ed610ff282610fab565b81815285602083850101111561130257600080fd5b6113138260208301602086016110ea565b95945050505050565b60608152600061132f606083018661110e565b6001600160a01b0394851660208401529290931660409091015292915050565b60006020828403121561136157600080fd5b81518015158114610f5d57600080fd5b60a08152600061138460a083018861110e565b8281036020840152611396818861110e565b905082810360408401526113aa818761110e565b905082810360608401526113be818661110e565b905082810360808401526113d2818561110e565b9897505050505050505056fea2646970667358221220f24c72179ae52649db9edfc49327676600f6548bf80be2ac1838fbfaf00f29af64736f6c63430008170033" +access(all) let compiledFactoryBytecode = "608060405234801561001057600080fd5b50338061003757604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61004081610046565b50610096565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611452806100a56000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c8063aff51c3e11610097578063daa09e5411610066578063daa09e5414610216578063db6d56cd14610229578063dfe1ac361461023c578063f2fde38b1461024f57600080fd5b8063aff51c3e146101bd578063b3d5dbdc146101d0578063cc435bf3146101f0578063d974d2381461020357600080fd5b806366cd5014116100d357806366cd50141461017e578063715018a61461019157806383843c9e146101995780638da5cb5b146101ac57600080fd5b806304433bbc1461010557806314902ad314610135578063263e0c1b1461014a5780635ab1bd531461016d575b600080fd5b610118610113366004611067565b610262565b6040516001600160a01b0390911681526020015b60405180910390f35b6101486101433660046110b9565b6102da565b005b61015d6101583660046110b9565b610354565b604051901515815260200161012c565b6001546001600160a01b0316610118565b61011861018c366004611067565b610744565b610148610775565b6101486101a7366004611067565b610789565b6000546001600160a01b0316610118565b6101486101cb3660046110d6565b61088b565b6101e36101de3660046110b9565b6109a4565b60405161012c9190611178565b61015d6101fe3660046110b9565b610a17565b6101486102113660046110d6565b610a37565b61015d6102243660046110b9565b610b08565b61011861023736600461118b565b610b7e565b61015d61024a3660046110b9565b610c53565b61014861025d3660046110b9565b610cc2565b600154604051630110ceef60e21b81526000916001600160a01b0316906304433bbc90610293908590600401611178565b602060405180830381865afa1580156102b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d49190611280565b92915050565b6102e2610d00565b6102eb81610d2d565b600154604080516001600160a01b03928316815291831660208301527f61dad6e94cd5c0b65c9265246706a09bd0d11d5330f3e6b659d328151a664e8c910160405180910390a1600180546001600160a01b0319166001600160a01b0392909216919091179055565b60408051600481526024810182526020810180516001600160e01b03166318160ddd60e01b1790529051600091829182916001600160a01b0386169161039a919061129d565b600060405180830381855afa9150503d80600081146103d5576040519150601f19603f3d011682016040523d82523d6000602084013e6103da565b606091505b50915091508115806103eb57508051155b156103fa575060009392505050565b604051600060248201526001600160a01b0385169060440160408051601f198184030181529181526020820180516001600160e01b03166370a0823160e01b17905251610447919061129d565b600060405180830381855afa9150503d8060008114610482576040519150601f19603f3d011682016040523d82523d6000602084013e610487565b606091505b50909250905081158061049957508051155b156104a8575060009392505050565b60405160006024820181905260448201526001600160a01b0385169060640160408051601f198184030181529181526020820180516001600160e01b0316636eb1769f60e11b179052516104fc919061129d565b600060405180830381855afa9150503d8060008114610537576040519150601f19603f3d011682016040523d82523d6000602084013e61053c565b606091505b50909250905081158061054e57508051155b1561055d575060009392505050565b60408051600481526024810182526020810180516001600160e01b03166306fdde0360e01b17905290516001600160a01b0386169161059b9161129d565b600060405180830381855afa9150503d80600081146105d6576040519150601f19603f3d011682016040523d82523d6000602084013e6105db565b606091505b5090925090508115806105ed57508051155b156105fc575060009392505050565b60408051600481526024810182526020810180516001600160e01b03166395d89b4160e01b17905290516001600160a01b0386169161063a9161129d565b600060405180830381855afa9150503d8060008114610675576040519150601f19603f3d011682016040523d82523d6000602084013e61067a565b606091505b50909250905081158061068c57508051155b1561069b575060009392505050565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b17905290516001600160a01b038616916106d99161129d565b600060405180830381855afa9150503d8060008114610714576040519150601f19603f3d011682016040523d82523d6000602084013e610719565b606091505b50909250905081158061072b57508051155b1561073a575060009392505050565b5060019392505050565b6000600282604051610756919061129d565b908152604051908190036020019020546001600160a01b031692915050565b61077d610d00565b6107876000610d9f565b565b610791610d00565b60006002826040516107a3919061129d565b908152604051908190036020019020546001600160a01b03169050806108235760405162461bcd60e51b815260206004820152602a60248201527f466c6f77427269646765466163746f72793a204465706c6f796572206e6f74206044820152691c9959da5cdd195c995960b21b60648201526084015b60405180910390fd5b600282604051610833919061129d565b90815260405190819003602001812080546001600160a01b03191690557f03c7566b5f4959b890c1a6d38f39df053c6737c9965d9c0ddf612c86100a838b9061087f90849084906112b9565b60405180910390a15050565b610893610d00565b61089c81610def565b60006001600160a01b03166002836040516108b7919061129d565b908152604051908190036020019020546001600160a01b0316146109345760405162461bcd60e51b815260206004820152602e60248201527f466c6f77427269646765466163746f72793a204465706c6f79657220616c726560448201526d18591e481c9959da5cdd195c995960921b606482015260840161081a565b80600283604051610945919061129d565b90815260405190819003602001812080546001600160a01b03939093166001600160a01b0319909316929092179091557fc0c30f085f0b1397c8bf23f8b851b63b33e13d11832b8320a37fca1c07dcb40f9061087f90849084906112b9565b600154604051632cf576f760e21b81526001600160a01b038381166004830152606092169063b3d5dbdc90602401600060405180830381865afa1580156109ef573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102d491908101906112e3565b6000610a2282610b08565b1515610a2d83610354565b1515141592915050565b610a3f610d00565b610a4881610def565b6000600283604051610a5a919061129d565b908152604051908190036020019020546001600160a01b0316905080610a8957610a84838361088b565b505050565b81600284604051610a9a919061129d565b90815260405190819003602001812080546001600160a01b03939093166001600160a01b0319909316929092179091557f848576f8a081c5af60d89f0215c8af528186670eefd6349c05014d5b2268864690610afb9085908490869061135a565b60405180910390a1505050565b6040516301ffc9a760e01b81526380ac58cd60e01b60048201526000906001600160a01b038316906301ffc9a790602401602060405180830381865afa925050508015610b72575060408051601f3d908101601f19168201909252610b6f9181019061138d565b60015b6102d457506000919050565b6000610b88610d00565b6000600288604051610b9a919061129d565b908152604051908190036020019020546001600160a01b03169050610bbe81610def565b60405163476d399760e01b815281906000906001600160a01b0383169063476d399790610bf7908c908c908c908c908c906004016113af565b6020604051808303816000875af1158015610c16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3a9190611280565b9050610c468682610e61565b9998505050505050505050565b60015460405163a6de610560e01b81526001600160a01b038381166004830152600092169063a6de610590602401602060405180830381865afa158015610c9e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d4919061138d565b610cca610d00565b6001600160a01b038116610cf457604051631e4fbdf760e01b81526000600482015260240161081a565b610cfd81610d9f565b50565b6000546001600160a01b031633146107875760405163118cdaa760e01b815233600482015260240161081a565b610d3681610ecc565b610d478163976998cb60e01b610f22565b610cfd5760405162461bcd60e51b815260206004820152602360248201527f466c6f77427269646765466163746f72793a20496e76616c696420726567697360448201526274727960e81b606482015260840161081a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610df881610ecc565b610e098163476d399760e01b610f22565b610cfd5760405162461bcd60e51b815260206004820152602360248201527f466c6f77427269646765466163746f72793a20496e76616c6964206465706c6f6044820152623cb2b960e91b606482015260840161081a565b60015460405163522791d160e01b81526001600160a01b0390911690819063522791d190610e9590869086906004016112b9565b600060405180830381600087803b158015610eaf57600080fd5b505af1158015610ec3573d6000803e3d6000fd5b50505050505050565b6001600160a01b038116610cfd5760405162461bcd60e51b815260206004820152601f60248201527f466c6f77427269646765466163746f72793a205a65726f206164647265737300604482015260640161081a565b6040516301ffc9a760e01b81526001600160e01b0319821660048201526000906001600160a01b038416906301ffc9a790602401602060405180830381865afa925050508015610f8f575060408051601f3d908101601f19168201909252610f8c9181019061138d565b60015b610f9b575060006102d4565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610fe157610fe1610fa2565b604052919050565b600067ffffffffffffffff82111561100357611003610fa2565b50601f01601f191660200190565b600082601f83011261102257600080fd5b813561103561103082610fe9565b610fb8565b81815284602083860101111561104a57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561107957600080fd5b813567ffffffffffffffff81111561109057600080fd5b61109c84828501611011565b949350505050565b6001600160a01b0381168114610cfd57600080fd5b6000602082840312156110cb57600080fd5b8135610f9b816110a4565b600080604083850312156110e957600080fd5b823567ffffffffffffffff81111561110057600080fd5b61110c85828601611011565b925050602083013561111d816110a4565b809150509250929050565b60005b8381101561114357818101518382015260200161112b565b50506000910152565b60008151808452611164816020860160208601611128565b601f01601f19169290920160200192915050565b602081526000610f9b602083018461114c565b60008060008060008060c087890312156111a457600080fd5b863567ffffffffffffffff808211156111bc57600080fd5b6111c88a838b01611011565b975060208901359150808211156111de57600080fd5b6111ea8a838b01611011565b9650604089013591508082111561120057600080fd5b61120c8a838b01611011565b9550606089013591508082111561122257600080fd5b61122e8a838b01611011565b9450608089013591508082111561124457600080fd5b6112508a838b01611011565b935060a089013591508082111561126657600080fd5b5061127389828a01611011565b9150509295509295509295565b60006020828403121561129257600080fd5b8151610f9b816110a4565b600082516112af818460208701611128565b9190910192915050565b6040815260006112cc604083018561114c565b905060018060a01b03831660208301529392505050565b6000602082840312156112f557600080fd5b815167ffffffffffffffff81111561130c57600080fd5b8201601f8101841361131d57600080fd5b805161132b61103082610fe9565b81815285602083850101111561134057600080fd5b611351826020830160208601611128565b95945050505050565b60608152600061136d606083018661114c565b6001600160a01b0394851660208401529290931660409091015292915050565b60006020828403121561139f57600080fd5b81518015158114610f9b57600080fd5b60a0815260006113c260a083018861114c565b82810360208401526113d4818861114c565b905082810360408401526113e8818761114c565b905082810360608401526113fc818661114c565b90508281036080840152611410818561114c565b9897505050505050505056fea264697066735822122026be7d4ef13534833344abdcc736e8876603e1f9d3463f0047ddca092a98cc2d64736f6c63430008170033" access(all) let erc20DeployerBytecode = "608060405234801561001057600080fd5b50338061003757604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61004081610046565b50610096565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b612096806100a56000396000f3fe60806040523480156200001157600080fd5b5060043610620000875760003560e01c8063715018a61162000062578063715018a614620000fc5780638da5cb5b1462000108578063ee2d8496146200011a578063f2fde38b146200013157600080fd5b806301ffc9a7146200008c578063476d399714620000b85780636418e6de14620000e8575b600080fd5b620000a36200009d36600462000438565b62000148565b60405190151581526020015b60405180910390f35b620000cf620000c936600462000516565b62000180565b6040516001600160a01b039091168152602001620000af565b600154620000cf906001600160a01b031681565b62000106620002a5565b005b6000546001600160a01b0316620000cf565b620001066200012b366004620005f8565b620002bd565b6200010662000142366004620005f8565b62000367565b60006001600160e01b0319821663476d399760e01b14806200017a57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6001546000906001600160a01b03163314620002095760405162461bcd60e51b815260206004820152603f60248201527f466c6f7745564d4272696467656445524332304465706c6f7965723a204f6e6c60448201527f792064656c656761746564206465706c6f7965722063616e206465706c6f790060648201526084015b60405180910390fd5b600080546001600160a01b0316878787878760405162000229906200042a565b6200023a969594939291906200066b565b604051809103906000f08015801562000257573d6000803e3d6000fd5b5090507f99a64021330f1af36b3fd5f64a1d12b99b8ddf91fa553618c4df01ffba4c1cee818888888860405162000293959493929190620006f4565b60405180910390a19695505050505050565b620002af620003ab565b620002bb6000620003da565b565b620002c7620003ab565b6001600160a01b038116620003455760405162461bcd60e51b815260206004820152603f60248201527f466c6f7745564d4272696467656445524332304465706c6f7965723a20496e7660448201527f616c69642064656c656761746564206465706c6f796572206164647265737300606482015260840162000200565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b62000371620003ab565b6001600160a01b0381166200039d57604051631e4fbdf760e01b81526000600482015260240162000200565b620003a881620003da565b50565b6000546001600160a01b03163314620002bb5760405163118cdaa760e01b815233600482015260240162000200565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6118fa806200076783390190565b6000602082840312156200044b57600080fd5b81356001600160e01b0319811681146200046457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200049357600080fd5b813567ffffffffffffffff80821115620004b157620004b16200046b565b604051601f8301601f19908116603f01168101908282118183101715620004dc57620004dc6200046b565b81604052838152866020858801011115620004f657600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600080600060a086880312156200052f57600080fd5b853567ffffffffffffffff808211156200054857600080fd5b6200055689838a0162000481565b965060208801359150808211156200056d57600080fd5b6200057b89838a0162000481565b955060408801359150808211156200059257600080fd5b620005a089838a0162000481565b94506060880135915080821115620005b757600080fd5b620005c589838a0162000481565b93506080880135915080821115620005dc57600080fd5b50620005eb8882890162000481565b9150509295509295909350565b6000602082840312156200060b57600080fd5b81356001600160a01b03811681146200046457600080fd5b6000815180845260005b818110156200064b576020818501810151868301820152016200062d565b506000602082860101526020601f19601f83011685010191505092915050565b6001600160a01b038716815260c060208201819052600090620006919083018862000623565b8281036040840152620006a5818862000623565b90508281036060840152620006bb818762000623565b90508281036080840152620006d1818662000623565b905082810360a0840152620006e7818562000623565b9998505050505050505050565b6001600160a01b038616815260a0602082018190526000906200071a9083018762000623565b82810360408401526200072e818762000623565b9050828103606084015262000744818662000623565b905082810360808401526200075a818562000623565b9897505050505050505056fe6101606040523480156200001257600080fd5b50604051620018fa380380620018fa833981016040819052620000359162000357565b6040805180820190915260018152603160f81b6020820152859081908882886003620000628382620004db565b506004620000718282620004db565b5050506001600160a01b038116620000a457604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b620000af816200019f565b50620000bd826006620001f1565b61012052620000ce816007620001f1565b61014052815160208084019190912060e052815190820120610100524660a0526200015c60e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60805250503060c052506009620001748482620004db565b50600a620001838382620004db565b50600b620001928282620004db565b5050505050505062000601565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000602083511015620002115762000209836200022a565b905062000224565b816200021e8482620004db565b5060ff90505b92915050565b600080829050601f8151111562000258578260405163305a27a960e01b81526004016200009b9190620005a7565b80516200026582620005dc565b179392505050565b80516001600160a01b03811681146200028557600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620002bd578181015183820152602001620002a3565b50506000910152565b600082601f830112620002d857600080fd5b81516001600160401b0380821115620002f557620002f56200028a565b604051601f8301601f19908116603f011681019082821181831017156200032057620003206200028a565b816040528381528660208588010111156200033a57600080fd5b6200034d846020830160208901620002a0565b9695505050505050565b60008060008060008060c087890312156200037157600080fd5b6200037c876200026d565b60208801519096506001600160401b03808211156200039a57600080fd5b620003a88a838b01620002c6565b96506040890151915080821115620003bf57600080fd5b620003cd8a838b01620002c6565b95506060890151915080821115620003e457600080fd5b620003f28a838b01620002c6565b945060808901519150808211156200040957600080fd5b620004178a838b01620002c6565b935060a08901519150808211156200042e57600080fd5b506200043d89828a01620002c6565b9150509295509295509295565b600181811c908216806200045f57607f821691505b6020821081036200048057634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620004d6576000816000526020600020601f850160051c81016020861015620004b15750805b601f850160051c820191505b81811015620004d257828155600101620004bd565b5050505b505050565b81516001600160401b03811115620004f757620004f76200028a565b6200050f816200050884546200044a565b8462000486565b602080601f8311600181146200054757600084156200052e5750858301515b600019600386901b1c1916600185901b178555620004d2565b600085815260208120601f198616915b82811015620005785788860151825594840194600190910190840162000557565b5085821015620005975787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6020815260008251806020840152620005c8816040850160208701620002a0565b601f01601f19169190910160400192915050565b80516020808301519190811015620004805760001960209190910360031b1b16919050565b60805160a05160c05160e05161010051610120516101405161129e6200065c6000396000610a8801526000610a5b01526000610918015260006108f00152600061084b015260006108750152600061089f015261129e6000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c8063715018a6116100de578063a76b4d5611610097578063dc9716eb11610071578063dc9716eb146102f8578063dd62ed3e14610300578063e8a3d48514610339578063f2fde38b1461034157600080fd5b8063a76b4d56146102ca578063a9059cbb146102d2578063d505accf146102e557600080fd5b8063715018a61461025e57806379cc6790146102665780637ecebe001461027957806384b0196e1461028c5780638da5cb5b146102a757806395d89b41146102c257600080fd5b8063313ce56711610130578063313ce567146101ee5780633644e515146101fd5780633fd4d4a81461020557806340c10f191461020d57806342966c681461022257806370a082311461023557600080fd5b806306fdde0314610178578063095ea7b3146101965780630cd9acb7146101b9578063120a88ad146101c157806318160ddd146101c957806323b872dd146101db575b600080fd5b610180610354565b60405161018d9190610fe8565b60405180910390f35b6101a96101a436600461101e565b6103e6565b604051901515815260200161018d565b610180610400565b61018061048e565b6002545b60405190815260200161018d565b6101a96101e9366004611048565b61049d565b6040516012815260200161018d565b6101cd6104c1565b6101806104d0565b61022061021b36600461101e565b6104df565b005b610220610230366004611084565b6104f5565b6101cd61024336600461109d565b6001600160a01b031660009081526020819052604090205490565b610220610502565b61022061027436600461101e565b610516565b6101cd61028736600461109d565b61052b565b610294610549565b60405161018d97969594939291906110b8565b6005546040516001600160a01b03909116815260200161018d565b61018061058f565b61018061059e565b6101a96102e036600461101e565b6105ab565b6102206102f3366004611151565b6105b9565b6101806106f8565b6101cd61030e3660046111c4565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610180610705565b61022061034f36600461109d565b610714565b606060038054610363906111f7565b80601f016020809104026020016040519081016040528092919081815260200182805461038f906111f7565b80156103dc5780601f106103b1576101008083540402835291602001916103dc565b820191906000526020600020905b8154815290600101906020018083116103bf57829003601f168201915b5050505050905090565b6000336103f481858561074f565b60019150505b92915050565b6009805461040d906111f7565b80601f0160208091040260200160405190810160405280929190818152602001828054610439906111f7565b80156104865780601f1061045b57610100808354040283529160200191610486565b820191906000526020600020905b81548152906001019060200180831161046957829003601f168201915b505050505081565b606060098054610363906111f7565b6000336104ab858285610761565b6104b68585856107df565b506001949350505050565b60006104cb61083e565b905090565b6060600a8054610363906111f7565b6104e7610969565b6104f18282610996565b5050565b6104ff33826109cc565b50565b61050a610969565b6105146000610a02565b565b610521823383610761565b6104f182826109cc565b6001600160a01b0381166000908152600860205260408120546103fa565b60006060806000806000606061055d610a54565b610565610a81565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b606060048054610363906111f7565b600b805461040d906111f7565b6000336103f48185856107df565b834211156105e25760405163313c898160e11b8152600481018590526024015b60405180910390fd5b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c988888861062f8c6001600160a01b0316600090815260086020526040902080546001810190915590565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e001604051602081830303815290604052805190602001209050600061068a82610aae565b9050600061069a82878787610adb565b9050896001600160a01b0316816001600160a01b0316146106e1576040516325c0072360e11b81526001600160a01b0380831660048301528b1660248201526044016105d9565b6106ec8a8a8a61074f565b50505050505050505050565b600a805461040d906111f7565b6060600b8054610363906111f7565b61071c610969565b6001600160a01b03811661074657604051631e4fbdf760e01b8152600060048201526024016105d9565b6104ff81610a02565b61075c8383836001610b09565b505050565b6001600160a01b0383811660009081526001602090815260408083209386168352929052205460001981146107d957818110156107ca57604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064016105d9565b6107d984848484036000610b09565b50505050565b6001600160a01b03831661080957604051634b637e8f60e11b8152600060048201526024016105d9565b6001600160a01b0382166108335760405163ec442f0560e01b8152600060048201526024016105d9565b61075c838383610bde565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561089757507f000000000000000000000000000000000000000000000000000000000000000046145b156108c157507f000000000000000000000000000000000000000000000000000000000000000090565b6104cb604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6005546001600160a01b031633146105145760405163118cdaa760e01b81523360048201526024016105d9565b6001600160a01b0382166109c05760405163ec442f0560e01b8152600060048201526024016105d9565b6104f160008383610bde565b6001600160a01b0382166109f657604051634b637e8f60e11b8152600060048201526024016105d9565b6104f182600083610bde565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60606104cb7f00000000000000000000000000000000000000000000000000000000000000006006610d08565b60606104cb7f00000000000000000000000000000000000000000000000000000000000000006007610d08565b60006103fa610abb61083e565b8360405161190160f01b8152600281019290925260228201526042902090565b600080600080610aed88888888610db3565b925092509250610afd8282610e82565b50909695505050505050565b6001600160a01b038416610b335760405163e602df0560e01b8152600060048201526024016105d9565b6001600160a01b038316610b5d57604051634a1406b160e11b8152600060048201526024016105d9565b6001600160a01b03808516600090815260016020908152604080832093871683529290522082905580156107d957826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610bd091815260200190565b60405180910390a350505050565b6001600160a01b038316610c09578060026000828254610bfe9190611231565b90915550610c7b9050565b6001600160a01b03831660009081526020819052604090205481811015610c5c5760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016105d9565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216610c9757600280548290039055610cb6565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610cfb91815260200190565b60405180910390a3505050565b606060ff8314610d2257610d1b83610f3b565b90506103fa565b818054610d2e906111f7565b80601f0160208091040260200160405190810160405280929190818152602001828054610d5a906111f7565b8015610da75780601f10610d7c57610100808354040283529160200191610da7565b820191906000526020600020905b815481529060010190602001808311610d8a57829003601f168201915b505050505090506103fa565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610dee5750600091506003905082610e78565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610e42573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610e6e57506000925060019150829050610e78565b9250600091508190505b9450945094915050565b6000826003811115610e9657610e96611252565b03610e9f575050565b6001826003811115610eb357610eb3611252565b03610ed15760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610ee557610ee5611252565b03610f065760405163fce698f760e01b8152600481018290526024016105d9565b6003826003811115610f1a57610f1a611252565b036104f1576040516335e2f38360e21b8152600481018290526024016105d9565b60606000610f4883610f7a565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b600060ff8216601f8111156103fa57604051632cd44ac360e21b815260040160405180910390fd5b6000815180845260005b81811015610fc857602081850181015186830182015201610fac565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000610ffb6020830184610fa2565b9392505050565b80356001600160a01b038116811461101957600080fd5b919050565b6000806040838503121561103157600080fd5b61103a83611002565b946020939093013593505050565b60008060006060848603121561105d57600080fd5b61106684611002565b925061107460208501611002565b9150604084013590509250925092565b60006020828403121561109657600080fd5b5035919050565b6000602082840312156110af57600080fd5b610ffb82611002565b60ff60f81b881681526000602060e060208401526110d960e084018a610fa2565b83810360408501526110eb818a610fa2565b606085018990526001600160a01b038816608086015260a0850187905284810360c08601528551808252602080880193509091019060005b8181101561113f57835183529284019291840191600101611123565b50909c9b505050505050505050505050565b600080600080600080600060e0888a03121561116c57600080fd5b61117588611002565b965061118360208901611002565b95506040880135945060608801359350608088013560ff811681146111a757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b600080604083850312156111d757600080fd5b6111e083611002565b91506111ee60208401611002565b90509250929050565b600181811c9082168061120b57607f821691505b60208210810361122b57634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156103fa57634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fdfea26469706673582212206fb41458119173f9f1d07720d0b22fbfacf4726505008b5c43816c9902cd0fc464736f6c63430008170033a2646970667358221220fbaaee74b0e14c12923bfbdc4701408031af759f454cf27df9e8defc7658e96264736f6c63430008170033" diff --git a/solidity/src/FlowBridgeFactory.sol b/solidity/src/FlowBridgeFactory.sol index d817e3c3..2e3a306c 100644 --- a/solidity/src/FlowBridgeFactory.sol +++ b/solidity/src/FlowBridgeFactory.sol @@ -19,7 +19,12 @@ import {FlowEVMDeploymentRegistry} from "./interfaces/FlowEVMDeploymentRegistry. * to be swapped out without affecting the underlying associations between Cadence and EVM contracts. */ contract FlowBridgeFactory is Ownable { - // Address of the deployment registry where deployed contract associations are registered + // Address of the deployment registry where deployed contract associations are registered. Note that this is a + // registry for EVM contracts deployed by the bridge factory and does not include those EVM-native contracts that + // have been onboarded to the bridge via Cadence contracts. The global source of truth is found in the Cadence + // side of the bridge, however this registry and publicly accessible methods can serve as a source of truth + // within EVM. Given some EVM contract, its bridge-supported Cadence type association can be found (and vice-versa) + // by querying this contract, thus preventing impersonation attacks. address private deploymentRegistry; // Mapping of deployer tags to their implementation addresses mapping(string => address) private deployers; @@ -161,6 +166,17 @@ contract FlowBridgeFactory is Ownable { } } + /** + * @dev Determines if a contract is a valid asset by checking if it is either an ERC20 or ERC721 implementation + * + * @param contractAddr The address of the contract to check + * + * @return True if the contract is a valid asset, false otherwise + */ + function isValidAsset(address contractAddr) public view returns (bool) { + return isERC20(contractAddr) != isERC721(contractAddr); + } + /** * @dev Retrieves the address of the deployment registry *